diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-03-21 10:28:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 11:16:53 +0000 |
commit | 06cba6ccd165ca8b224797e37fccb9e63f026d77 (patch) | |
tree | e82f1bc439997ae296f2e74f8a64d84c5d95f140 /iredis/key_bindings.py | |
parent | Initial commit. (diff) | |
download | iredis-06cba6ccd165ca8b224797e37fccb9e63f026d77.tar.xz iredis-06cba6ccd165ca8b224797e37fccb9e63f026d77.zip |
Adding upstream version 1.9.1.upstream/1.9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'iredis/key_bindings.py')
-rw-r--r-- | iredis/key_bindings.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/iredis/key_bindings.py b/iredis/key_bindings.py new file mode 100644 index 0000000..fad4127 --- /dev/null +++ b/iredis/key_bindings.py @@ -0,0 +1,22 @@ +import logging + +from prompt_toolkit.filters import completion_is_selected +from prompt_toolkit.key_binding import KeyBindings + +logger = logging.getLogger(__name__) + +kb = KeyBindings() + + +@kb.add("enter", filter=completion_is_selected) +def _(event): + """Makes the enter key work as the tab key only when showing the menu. + In other words, don't execute query when enter is pressed in + the completion dropdown menu, instead close the dropdown menu + (accept current selection). + """ + logger.debug("Detected enter key.") + + event.current_buffer.complete_state = None + b = event.app.current_buffer + b.complete_state = None |