diff options
author | Irina Truong <i.chernyavska@gmail.com> | 2020-05-08 12:49:41 -0700 |
---|---|---|
committer | Irina Truong <i.chernyavska@gmail.com> | 2020-09-25 11:24:18 -0700 |
commit | 4770556cfba7aa424f809f8338cc61f4cb069436 (patch) | |
tree | 3fb295cd30fe2734c12846e4fb74f9f4e138d9ac | |
parent | 9a716c47f5199ccf36a2d797515f658a4179a855 (diff) |
Complete first suggestion on enter in multi-line mode as well.j-bennet/enter-accept-first
-rw-r--r-- | pgcli/pgbuffer.py | 6 |
1 files 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 |