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
wilder-portage
Mariusz Glebocki 8 years ago committed by Kurt Hindenburg
parent 98b05633b6
commit c0a46e2b08
  1. 5
      src/Vt102Emulation.cpp

@ -1044,11 +1044,8 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event)
KeyboardTranslator::States states = KeyboardTranslator::NoState; KeyboardTranslator::States states = KeyboardTranslator::NoState;
TerminalDisplay * currentView = _currentScreen->currentTerminalDisplay(); TerminalDisplay * currentView = _currentScreen->currentTerminalDisplay();
if (currentView == nullptr) {
return;
}
bool isReadOnly = false; bool isReadOnly = false;
if (currentView->sessionController() != nullptr) { if (currentView != nullptr && currentView->sessionController() != nullptr) {
isReadOnly = currentView->sessionController()->isReadOnly(); isReadOnly = currentView->sessionController()->isReadOnly();
} }

Loading…
Cancel
Save