summaryrefslogtreecommitdiffstats
path: root/mycli/key_bindings.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-08 06:39:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-08 06:39:52 +0000
commitf96615a770febe0d511ad79d17169aca58095bf2 (patch)
tree60c586dcee842be1b061221a5fb454a153857585 /mycli/key_bindings.py
parentAdding upstream version 1.23.2. (diff)
downloadmycli-f96615a770febe0d511ad79d17169aca58095bf2.tar.xz
mycli-f96615a770febe0d511ad79d17169aca58095bf2.zip
Adding upstream version 1.24.1.upstream/1.24.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mycli/key_bindings.py')
-rw-r--r--mycli/key_bindings.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mycli/key_bindings.py b/mycli/key_bindings.py
index 57b917b..4a24c82 100644
--- a/mycli/key_bindings.py
+++ b/mycli/key_bindings.py
@@ -78,8 +78,12 @@ def mycli_bindings(mycli):
@kb.add('escape', 'enter')
def _(event):
- """Introduces a line break regardless of multi-line mode or not."""
+ """Introduces a line break in multi-line mode, or dispatches the
+ command in single-line mode."""
_logger.debug('Detected alt-enter key.')
- event.app.current_buffer.insert_text('\n')
+ if mycli.multi_line:
+ event.app.current_buffer.validate_and_handle()
+ else:
+ event.app.current_buffer.insert_text('\n')
return kb