diff --git a/doc/manual/index.docbook b/doc/manual/index.docbook
index 4ba39eb6f..016b7edd2 100644
--- a/doc/manual/index.docbook
+++ b/doc/manual/index.docbook
@@ -52,7 +52,7 @@
&FDLNotice;
-2022-12-10
+2023-02-10
KDE Gear 23.04
&konsole; is &kde;'s terminal emulator.
@@ -119,6 +119,10 @@ without the mouse.
Enter and leave this mode by using the keyboard shortcut (&Ctrl;&Shift;D by default).
+
+Esc also leaves the keyboard selection mode.
+
+
Moving the cursor: Arrows, PageUp, PageDown, Home, End.
diff --git a/src/session/SessionController.cpp b/src/session/SessionController.cpp
index 5cf6f6b5a..cd5d49b6f 100644
--- a/src/session/SessionController.cpp
+++ b/src/session/SessionController.cpp
@@ -452,14 +452,12 @@ void SessionController::setupPrimaryScreenSpecificActions(bool use)
QAction *clearAction = collection->action(QStringLiteral("clear-history"));
QAction *resetAction = collection->action(QStringLiteral("clear-history-and-reset"));
QAction *selectAllAction = collection->action(QStringLiteral("select-all"));
- QAction *selectModeAction = collection->action(QStringLiteral("select-mode"));
QAction *selectLineAction = collection->action(QStringLiteral("select-line"));
// these actions are meaningful only when primary screen is used.
clearAction->setEnabled(use);
resetAction->setEnabled(use);
selectAllAction->setEnabled(use);
- selectModeAction->setEnabled(use);
selectLineAction->setEnabled(use);
}
@@ -1241,11 +1239,17 @@ void SessionController::selectAll()
void SessionController::selectMode()
{
if (!session().isNull()) {
- QAction *readonlyAction = actionCollection()->action(QStringLiteral("view-readonly"));
bool Mode = session()->getSelectMode();
- session()->setSelectMode(!Mode);
- readonlyAction->setEnabled(Mode);
- view()->setSelectMode(!Mode);
+ setSelectMode(!Mode);
+ }
+}
+void SessionController::setSelectMode(bool mode)
+{
+ if (!session().isNull()) {
+ QAction *readonlyAction = actionCollection()->action(QStringLiteral("view-readonly"));
+ session()->setSelectMode(mode);
+ readonlyAction->setEnabled(!mode);
+ view()->setSelectMode(mode);
}
}
diff --git a/src/session/SessionController.h b/src/session/SessionController.h
index e284aa205..39473bc12 100644
--- a/src/session/SessionController.h
+++ b/src/session/SessionController.h
@@ -144,6 +144,9 @@ public:
bool isReadOnly() const;
bool isCopyInputActive() const;
+ /* Set/reset selection mode */
+ void setSelectMode(bool mode);
+
Q_SIGNALS:
/**
* Emitted when the view associated with the controller is focused.
diff --git a/src/terminalDisplay/TerminalDisplay.cpp b/src/terminalDisplay/TerminalDisplay.cpp
index fb8ba7465..cd9c5b729 100644
--- a/src/terminalDisplay/TerminalDisplay.cpp
+++ b/src/terminalDisplay/TerminalDisplay.cpp
@@ -2631,6 +2631,9 @@ void TerminalDisplay::keyPressEvent(QKeyEvent *event)
}
}
switch (event->key()) {
+ case Qt::Key_Escape:
+ sessionController()->setSelectMode(false);
+ break;
case Qt::Key_Left:
case Qt::Key_H:
SELECT_BY_MODIFIERS;