diff --git a/qutebrowser/keyinput/basekeyparser.py b/qutebrowser/keyinput/basekeyparser.py index f0f2c6f28..8161293cc 100644 --- a/qutebrowser/keyinput/basekeyparser.py +++ b/qutebrowser/keyinput/basekeyparser.py @@ -19,6 +19,8 @@ """Base class for vim-like key sequence parser.""" +import string + from PyQt5.QtCore import pyqtSignal, QObject from PyQt5.QtGui import QKeySequence @@ -136,7 +138,7 @@ class BaseKeyParser(QObject): def _match_count(self, sequence, dry_run): """Try to match a key as count.""" txt = str(sequence[-1]) # To account for sequences changed above. - if (txt.isdigit() and self._supports_count and + if (txt in string.digits and self._supports_count and not (not self._count and txt == '0')): self._debug_log("Trying match as count") assert len(txt) == 1, txt diff --git a/tests/unit/keyinput/test_basekeyparser.py b/tests/unit/keyinput/test_basekeyparser.py index 7915e2b75..135033ecd 100644 --- a/tests/unit/keyinput/test_basekeyparser.py +++ b/tests/unit/keyinput/test_basekeyparser.py @@ -320,6 +320,10 @@ class TestCount: keyparser.execute.assert_called_once_with('message-info ccc', 23) assert not keyparser._sequence + def test_superscript(self, handle_text, keyparser): + # https://github.com/qutebrowser/qutebrowser/issues/3743 + handle_text(Qt.Key_twosuperior, Qt.Key_B, Qt.Key_A) + def test_count_keystring_update(self, qtbot, handle_text, keyparser): """Make sure the keystring is updated correctly when entering count.""" with qtbot.waitSignals([keyparser.keystring_updated,