Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose wordCharacters property to QTermWidget API #531

Merged
merged 2 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ enum | KeyboardCursorShape { BlockCursor, UnderlineCursor, IBeamCursor }
* sizeHint : const QSize
* terminalSizeHint : bool
* title : const QString
* wordCharacters : QString
* workingDirectory : QString

### Public Functions
Expand Down Expand Up @@ -230,6 +231,10 @@ Returns the currently selected text.
<!--**title : const QString**\-->
<!--**workingDirectory : QString**\-->

**wordCharacters : QString**\
When selecting text by word, consider these characters to be word characters in addition to
alphanumeric characters, default is `:@-./_~`.

### Member Function Documentation
<!--__void activity()__\-->
<!--__void bell(const QString &_message_)__\-->
Expand Down
10 changes: 10 additions & 0 deletions lib/qtermwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,16 @@ void QTermWidget::setTrimPastedTrailingNewlines(bool trimPastedTrailingNewlines)
m_impl->m_terminalDisplay->setTrimPastedTrailingNewlines(trimPastedTrailingNewlines);
}

QString QTermWidget::wordCharacters() const
{
return m_impl->m_terminalDisplay->wordCharacters();
}

void QTermWidget::setWordCharacters(const QString& chars)
{
m_impl->m_terminalDisplay->setWordCharacters(chars);
}

QTermWidgetInterface* QTermWidget::createWidget(int startnow) const
{
return new QTermWidget(startnow);
Expand Down
3 changes: 3 additions & 0 deletions lib/qtermwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ class QTERMWIDGET_EXPORT QTermWidget : public QWidget, public QTermWidgetInterfa
void setConfirmMultilinePaste(bool confirmMultilinePaste) override;
void setTrimPastedTrailingNewlines(bool trimPastedTrailingNewlines) override;

QString wordCharacters() const override;
void setWordCharacters(const QString& chars) override;

QTermWidgetInterface *createWidget(int startnow) const override;
signals:
void finished();
Expand Down
4 changes: 3 additions & 1 deletion lib/qtermwidget_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ class QTermWidgetInterface {
virtual void setBoldIntense(bool boldIntense) = 0;
virtual void setConfirmMultilinePaste(bool confirmMultilinePaste) = 0;
virtual void setTrimPastedTrailingNewlines(bool trimPastedTrailingNewlines) = 0;
virtual QString wordCharacters() const = 0;
virtual void setWordCharacters(const QString& chars) = 0;
virtual QTermWidgetInterface* createWidget(int startnow) const = 0;
};

#define QTermWidgetInterface_iid "lxqt.qtermwidget.QTermWidgetInterface/1.0"
#define QTermWidgetInterface_iid "lxqt.qtermwidget.QTermWidgetInterface/1.5"
yan12125 marked this conversation as resolved.
Show resolved Hide resolved

Q_DECLARE_INTERFACE(QTermWidgetInterface, QTermWidgetInterface_iid)
Loading