summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Glebocki <[email protected]>2018-03-27 21:28:19 -0400
committerKurt Hindenburg <[email protected]>2018-03-28 09:08:56 -0400
commit594368b534a84552e1871c41651e58739634dbbf (patch)
tree9293d7fe98aea50a9924bd47545e3cb0199569f2
parent521592c41bc374a19f3655991a573a57188497c6 (diff)
Process key event even without active TerminalDisplay
Summary: There are (more or less) valid cases when currentTerminalDisplay can be not set: * konsole started with `--background-mode`, `sendText` called via D-Bus * text send through KPart's `sendInput()` It can be assumed read-only is not set in this case. This patch should also fix TerminalInterfaceTest. Currently the shell probably doesn't get commands send through sendInput. Test Plan: * Run `konsole --background-mode --nofork & ; sleep 2; qdbus org.kde.konsole-$! /Sessions/1 sendText $'echo test\n'` * Press Ctrl+Shift+F12 * The terminal should show `echo test` command and its result Reviewers: #konsole, hindenburg Reviewed By: #konsole, hindenburg Subscribers: hindenburg, #konsole Tags: #konsole Differential Revision: https://phabricator.kde.org/D11762 (cherry picked from commit c0a46e2b08ceaa6d193b58203b4e59cc2366bb4f)
-rw-r--r--src/Vt102Emulation.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp
index 7756e6d..d24c92b 100644
--- a/src/Vt102Emulation.cpp
+++ b/src/Vt102Emulation.cpp
@@ -1044,11 +1044,8 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event)
KeyboardTranslator::States states = KeyboardTranslator::NoState;
TerminalDisplay * currentView = _currentScreen->currentTerminalDisplay();
- if (currentView == nullptr) {
- return;
- }
bool isReadOnly = false;
- if (currentView->sessionController() != nullptr) {
+ if (currentView != nullptr && currentView->sessionController() != nullptr) {
isReadOnly = currentView->sessionController()->isReadOnly();
}