From 7e7cac2d4865c3ce634a7e79541ad99c655e041a Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Fri, 20 Jan 2017 17:26:14 +0100 Subject: [PATCH 1/2] 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 From 10ec240de14d8d2d8cfc87aa06fef9c0c57a6ce9 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 4 Feb 2017 18:01:22 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 193673f6b..4c30d2dbb 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -37,6 +37,7 @@ Fixed - Fixed various mouse actions (like automatically entering insert mode) not working with Qt 5.8 - Fixed hints sometimes not working with Qt 5.8 - `:enter-mode` now refuses to enter modes which can't be entered manually (which caused crashes). +- `:record-macro` (`q`) now doesn't try to record macros for special keys without a text. v0.9.1 ------