From 7e7cac2d4865c3ce634a7e79541ad99c655e041a Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Fri, 20 Jan 2017 17:26:14 +0100 Subject: [PATCH] Ignore non-register keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignore all keys with an empty .text() return value, not just modifier keys. You can still use unusual things like ß for registers, but XF86WakeUp is out. Fixes #2125. --- qutebrowser/keyinput/modeparsers.py | 8 ++++---- tests/end2end/features/keyinput.feature | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/qutebrowser/keyinput/modeparsers.py b/qutebrowser/keyinput/modeparsers.py index 257937852..db540b58e 100644 --- a/qutebrowser/keyinput/modeparsers.py +++ b/qutebrowser/keyinput/modeparsers.py @@ -294,12 +294,12 @@ class RegisterKeyParser(keyparser.CommandKeyParser): if super().handle(e): return True - if utils.keyevent_to_string(e) is None: - # this is a modifier key, let it pass and keep going - return False - key = e.text() + if key == '' or utils.keyevent_to_string(e) is None: + # this is not a proper register key, let it pass and keep going + return False + tabbed_browser = objreg.get('tabbed-browser', scope='window', window=self._win_id) macro_recorder = objreg.get('macro-recorder') diff --git a/tests/end2end/features/keyinput.feature b/tests/end2end/features/keyinput.feature index 3b4248e83..6777056e8 100644 --- a/tests/end2end/features/keyinput.feature +++ b/tests/end2end/features/keyinput.feature @@ -260,3 +260,19 @@ Feature: Keyboard input When I run :record-macro And I press the key "" Then "Leaving mode KeyMode.record_macro (reason: leave current)" should be logged + + Scenario: Ignoring non-register keys + Given I open data/scroll/simple.html + And I run :tab-only + When I run :scroll down with count 2 + And I wait until the scroll position changed + And I run :record-macro + And I press the key "" + And I press the key "c" + And I run :scroll up + And I wait until the scroll position changed + And I run :record-macro + And I run :run-macro + And I press the key "c" + And I wait until the scroll position changed to 0/0 + Then the page should not be scrolled