From 8755434f768b2ba57ab01e0cef70ccc21364f453 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Tue, 16 Jun 2020 20:44:24 +0200 Subject: [PATCH] Fix weird issue with text editor capturing enter key without having focus --- nw/gui/doceditor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 53ba7bc9..b2f2e49d 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -591,6 +591,9 @@ class GuiDocEditor(QTextEdit): as it is triggered on every keypress when typing. """ self.hasSelection = self.textCursor().hasSelection() + if not self.hasFocus(): + # Block the event when the focus is on the search bar. + return if keyEvent.modifiers() == Qt.ShiftModifier: theKey = keyEvent.key()