summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Stephens <owen@owenstephens.co.uk>2019-10-13 13:50:36 +0100
committerOwen Stephens <owen@owenstephens.co.uk>2019-10-13 13:50:36 +0100
commit6763433a687cc651d9ce5c97eeb81d83c4d34f71 (patch)
tree77e62b5bb06199cfbfef59ce5728c138887cd078
parent7f44748149be47cc42261ff73465a82eb7174eca (diff)
fixup! Handle a multi-line query on Enter key-press (fixes #1031)
-rw-r--r--pgcli/key_bindings.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pgcli/key_bindings.py b/pgcli/key_bindings.py
index a8f392f6..6eb71f9f 100644
--- a/pgcli/key_bindings.py
+++ b/pgcli/key_bindings.py
@@ -5,6 +5,7 @@ from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.filters import (
completion_is_selected,
+ is_searching,
has_completions,
has_selection,
)
@@ -97,10 +98,12 @@ def pgcli_bindings(pgcli):
event.app.current_buffer.complete_state = None
# When using multi_line input mode the buffer is not handled on Enter (a new line is
- # inserted instead), so we force the handling if one of several conditions are True
+ # inserted instead), so we force the handling if we're not in a completion or
+ # history search, and one of several conditions are True
@kb.add(
"enter",
- filter=~completion_is_selected & multi_line_buffer_should_be_handled(pgcli),
+ filter=~(completion_is_selected | is_searching)
+ & multi_line_buffer_should_be_handled(pgcli),
)
def _(event):
event.current_buffer.validate_and_handle()