diff options
author | Florian Bruhin <git@the-compiler.org> | 2018-05-22 12:25:45 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2018-05-22 12:25:45 +0200 |
commit | 29ad252278a3dab5f7d11181f93f65ef7b728d80 (patch) | |
tree | a8b9c644667ef5e48b65c071e1fbac6094a2790c /qutebrowser/keyinput/basekeyparser.py | |
parent | db1287cb82c216d1858abbd32bd9bbca3f86a6fd (diff) | |
download | qutebrowser-29ad252278a3dab5f7d11181f93f65ef7b728d80.tar.gz qutebrowser-29ad252278a3dab5f7d11181f93f65ef7b728d80.zip |
Handle ² keypress correctly
Turns out str.isdigit() also handles ² as a digit, but int('²') causes a
ValueError.
Here we use `string.digits` instead, which is '0123456789'.
Fixes #3743
Diffstat (limited to 'qutebrowser/keyinput/basekeyparser.py')
-rw-r--r-- | qutebrowser/keyinput/basekeyparser.py | 4 |
1 files changed, 3 insertions, 1 deletions
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 |