diff --git a/README.md b/README.md index 6cbeb171..e77d2ab7 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ enum | KeyboardCursorShape { BlockCursor, UnderlineCursor, IBeamCursor } * sizeHint : const QSize * terminalSizeHint : bool * title : const QString +* wordCharacters : QString * workingDirectory : QString ### Public Functions @@ -230,6 +231,10 @@ Returns the currently selected text. +**wordCharacters : QString**\ +When selecting text by word, consider these characters to be word characters in addition to +alphanumeric characters, default is `:@-./_~`. + ### Member Function Documentation diff --git a/lib/qtermwidget.cpp b/lib/qtermwidget.cpp index 07a0303d..b7f54346 100644 --- a/lib/qtermwidget.cpp +++ b/lib/qtermwidget.cpp @@ -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); diff --git a/lib/qtermwidget.h b/lib/qtermwidget.h index d7532fc4..c5805918 100644 --- a/lib/qtermwidget.h +++ b/lib/qtermwidget.h @@ -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(); diff --git a/lib/qtermwidget_interface.h b/lib/qtermwidget_interface.h index 2b9f19b1..18422798 100644 --- a/lib/qtermwidget_interface.h +++ b/lib/qtermwidget_interface.h @@ -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" Q_DECLARE_INTERFACE(QTermWidgetInterface, QTermWidgetInterface_iid)