summaryrefslogtreecommitdiff
path: root/qutebrowser/keyinput/basekeyparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'qutebrowser/keyinput/basekeyparser.py')
-rw-r--r--qutebrowser/keyinput/basekeyparser.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/qutebrowser/keyinput/basekeyparser.py b/qutebrowser/keyinput/basekeyparser.py
index ade336249..9630febab 100644
--- a/qutebrowser/keyinput/basekeyparser.py
+++ b/qutebrowser/keyinput/basekeyparser.py
@@ -42,7 +42,7 @@ class MatchResult:
sequence: keyutils.KeySequence
def __post_init__(self) -> None:
- if self.match_type == QKeySequence.ExactMatch:
+ if self.match_type == QKeySequence.SequenceMatch.ExactMatch:
assert self.command is not None
else:
assert self.command is None
@@ -89,7 +89,7 @@ class BindingTrie:
node.command = command
def __contains__(self, sequence: keyutils.KeySequence) -> bool:
- return self.matches(sequence).match_type == QKeySequence.ExactMatch
+ return self.matches(sequence).match_type == QKeySequence.SequenceMatch.ExactMatch
def __repr__(self) -> str:
return utils.get_repr(self, children=self.children,
@@ -131,20 +131,20 @@ class BindingTrie:
try:
node = node.children[key]
except KeyError:
- return MatchResult(match_type=QKeySequence.NoMatch,
+ return MatchResult(match_type=QKeySequence.SequenceMatch.NoMatch,
command=None,
sequence=sequence)
if node.command is not None:
- return MatchResult(match_type=QKeySequence.ExactMatch,
+ return MatchResult(match_type=QKeySequence.SequenceMatch.ExactMatch,
command=node.command,
sequence=sequence)
elif node.children:
- return MatchResult(match_type=QKeySequence.PartialMatch,
+ return MatchResult(match_type=QKeySequence.SequenceMatch.PartialMatch,
command=None,
sequence=sequence)
else: # This can only happen when there are no bindings at all.
- return MatchResult(match_type=QKeySequence.NoMatch,
+ return MatchResult(match_type=QKeySequence.SequenceMatch.NoMatch,
command=None,
sequence=sequence)
@@ -247,7 +247,7 @@ class BaseKeyParser(QObject):
self._debug_log("Mapped {} -> {}".format(
sequence, mapped))
return self._match_key(mapped)
- return MatchResult(match_type=QKeySequence.NoMatch,
+ return MatchResult(match_type=QKeySequence.SequenceMatch.NoMatch,
command=None,
sequence=sequence)
@@ -289,44 +289,44 @@ class BaseKeyParser(QObject):
if keyutils.is_modifier_key(key):
self._debug_log("Ignoring, only modifier")
- return QKeySequence.NoMatch
+ return QKeySequence.SequenceMatch.NoMatch
try:
sequence = self._sequence.append_event(e)
except keyutils.KeyParseError as ex:
self._debug_log("{} Aborting keychain.".format(ex))
self.clear_keystring()
- return QKeySequence.NoMatch
+ return QKeySequence.SequenceMatch.NoMatch
result = self._match_key(sequence)
del sequence # Enforce code below to use the modified result.sequence
- if result.match_type == QKeySequence.NoMatch:
+ if result.match_type == QKeySequence.SequenceMatch.NoMatch:
result = self._match_without_modifiers(result.sequence)
- if result.match_type == QKeySequence.NoMatch:
+ if result.match_type == QKeySequence.SequenceMatch.NoMatch:
result = self._match_key_mapping(result.sequence)
- if result.match_type == QKeySequence.NoMatch:
+ if result.match_type == QKeySequence.SequenceMatch.NoMatch:
was_count = self._match_count(result.sequence, dry_run)
if was_count:
- return QKeySequence.ExactMatch
+ return QKeySequence.SequenceMatch.ExactMatch
if dry_run:
return result.match_type
self._sequence = result.sequence
- if result.match_type == QKeySequence.ExactMatch:
+ if result.match_type == QKeySequence.SequenceMatch.ExactMatch:
assert result.command is not None
self._debug_log("Definitive match for '{}'.".format(
result.sequence))
count = int(self._count) if self._count else None
self.clear_keystring()
self.execute(result.command, count)
- elif result.match_type == QKeySequence.PartialMatch:
+ elif result.match_type == QKeySequence.SequenceMatch.PartialMatch:
self._debug_log("No match for '{}' (added {})".format(
result.sequence, txt))
self.keystring_updated.emit(self._count + str(result.sequence))
- elif result.match_type == QKeySequence.NoMatch:
+ elif result.match_type == QKeySequence.SequenceMatch.NoMatch:
self._debug_log("Giving up with '{}', no matches".format(
result.sequence))
self.clear_keystring()