summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Vērzemnieks <njvrzm@gmail.com>2019-04-13 13:22:03 -0700
committerIrina Truong <i.chernyavska@gmail.com>2019-04-13 13:22:03 -0700
commit4af4e33e31dc800a8ebaed517e0a781fa3dbb437 (patch)
tree3074506c259646fc8e1b26d60db4b4c1c1172e57
parent098a2cf976dff387e324db334cc5fbd17cbd1bc1 (diff)
Allow escape to switch to vi navigation mode (#1039)
-rw-r--r--AUTHORS1
-rw-r--r--changelog.rst8
-rw-r--r--pgcli/key_bindings.py4
3 files changed, 11 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS
index 28430c4b..c7a35d8c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -91,6 +91,7 @@ Contributors:
* Marcin Cieślak (saper)
* easteregg (verfriemelt-dot-org)
* Scott Brenstuhl (808sAndBR)
+ * Nathan Verzemnieks
Creator:
--------
diff --git a/changelog.rst b/changelog.rst
index 2c1324ef..6f6d693b 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -1,3 +1,10 @@
+Upcoming:
+=========
+
+Bug fixes:
+----------
+* Escape switches to VI navigation mode when not canceling completion popup. (Thanks: `Nathan Verzemnieks`_)
+
2.1.0
=====
@@ -950,3 +957,4 @@ Improvements:
.. _`Marcin Cieślak`: https://github.com/saper
.. _`Scott Brenstuhl`: https://github.com/808sAndBR
.. _`easteregg`: https://github.com/verfriemelt-dot-org
+.. _`Nathan Verzemnieks`: https://github.com/njvrzm
diff --git a/pgcli/key_bindings.py b/pgcli/key_bindings.py
index dbb4035c..d7750432 100644
--- a/pgcli/key_bindings.py
+++ b/pgcli/key_bindings.py
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
import logging
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding import KeyBindings
-from prompt_toolkit.filters import completion_is_selected
+from prompt_toolkit.filters import completion_is_selected, has_completions
_logger = logging.getLogger(__name__)
@@ -50,7 +50,7 @@ def pgcli_bindings(pgcli):
else:
buff.insert_text(tab_insert_text, fire_event=False)
- @kb.add('escape')
+ @kb.add('escape', filter=has_completions)
def _(event):
"""Force closing of autocompletion."""
_logger.debug('Detected <Esc> key.')