From 1f2128ead7bdbbd7994a7e26c7afe2249dd0ad44 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Sun, 25 Mar 2018 11:13:17 -0400 Subject: [PATCH] Partial revert of "Allow view-controlling keys in read-only mode" This reverts the Ctrl+S/Q/C not sending to a read-only/locked session. This portion is causing tests to fail on ASAN; which might be the tests fault, but for now revert. --- src/Vt102Emulation.cpp | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp index efaaf1df..79369088 100644 --- a/src/Vt102Emulation.cpp +++ b/src/Vt102Emulation.cpp @@ -37,7 +37,6 @@ // Konsole #include "KeyboardTranslator.h" -#include "SessionController.h" #include "TerminalDisplay.h" using Konsole::Vt102Emulation; @@ -1043,9 +1042,6 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event) const Qt::KeyboardModifiers modifiers = event->modifiers(); KeyboardTranslator::States states = KeyboardTranslator::NoState; - TerminalDisplay * currentView = _currentScreen->currentTerminalDisplay(); - const bool isReadOnly = currentView->sessionController()->isReadOnly(); - // get current states if (getMode(MODE_NewLine)) { states |= KeyboardTranslator::NewLineState; @@ -1063,18 +1059,16 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event) states |= KeyboardTranslator::ApplicationKeypadState; } - if (!isReadOnly) { - // check flow control state - if ((modifiers &Qt::ControlModifier) != 0u) { - switch (event->key()) { - case Qt::Key_S: - emit flowControlKeyPressed(true); - break; - case Qt::Key_Q: - case Qt::Key_C: // cancel flow control - emit flowControlKeyPressed(false); - break; - } + // check flow control state + if ((modifiers &Qt::ControlModifier) != 0u) { + switch (event->key()) { + case Qt::Key_S: + emit flowControlKeyPressed(true); + break; + case Qt::Key_Q: + case Qt::Key_C: // cancel flow control + emit flowControlKeyPressed(false); + break; } } @@ -1110,6 +1104,8 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event) if ( entry.command() != KeyboardTranslator::NoCommand ) { + TerminalDisplay * currentView = _currentScreen->currentTerminalDisplay(); + if ((entry.command() & KeyboardTranslator::EraseCommand) != 0) { textToSend += eraseChar(); } else if ((entry.command() & KeyboardTranslator::ScrollPageUpCommand) != 0) { @@ -1132,10 +1128,8 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event) textToSend += _codec->fromUnicode(event->text()); } - if (!isReadOnly) { - emit sendData(textToSend); - } - } else if (!isReadOnly) { + emit sendData(textToSend); + } else { // print an error message to the terminal if no key translator has been // set QString translatorError = i18n("No keyboard translator available. "