Skip to content

Commit 76d014e

Browse files
Ignore all other matches if eager key bindings were found.
1 parent 7866986 commit 76d014e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

prompt_toolkit/key_binding/input_processor.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ def _process(self):
148148
is_prefix_of_longer_match = self._is_prefix_of_longer_match(buffer)
149149
matches = self._get_matches(buffer)
150150

151-
# When longer matches were found, but the current match is
152-
# 'eager', ignore all the longer matches.
153-
if matches and matches[-1].eager(self._cli_ref()):
151+
# When eager matches were found, give priority to them and also
152+
# ignore all the longer matches.
153+
eager_matches = [m for m in matches if m.eager(self._cli_ref())]
154+
155+
if eager_matches:
156+
matches = eager_matches
154157
is_prefix_of_longer_match = False
155158

156159
# Exact matches found, call handler.

0 commit comments

Comments
 (0)