From 4770556cfba7aa424f809f8338cc61f4cb069436 Mon Sep 17 00:00:00 2001 From: Irina Truong Date: Fri, 8 May 2020 12:49:41 -0700 Subject: Complete first suggestion on enter in multi-line mode as well. --- pgcli/pgbuffer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pgcli/pgbuffer.py b/pgcli/pgbuffer.py index 706ed25f..cd29f036 100644 --- a/pgcli/pgbuffer.py +++ b/pgcli/pgbuffer.py @@ -33,11 +33,13 @@ def buffer_should_be_handled(pgcli): _logger.debug("Multi-line mode is set to 'safe'. Do NOT handle the buffer.") return False - doc = get_app().layout.get_buffer_by_name(DEFAULT_BUFFER).document + buf = get_app().layout.get_buffer_by_name(DEFAULT_BUFFER) + doc = buf.document text = doc.text.strip() return ( - text.startswith("\\") # Special Command + buf.complete_state # We have completions, and may want to select one. + or text.startswith("\\") # Special Command or text.endswith(r"\e") # Special Command or text.endswith(r"\G") # Ended with \e which should launch the editor or _is_complete(text) # A complete SQL command -- cgit v1.2.3