1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-04 09:17:08 +03:00

keybinding for dismissing autocompletelist (#1007)

* +added esc key to dismiss the autocomple list

* +added esc key to dismiss the autocomple list
This commit is contained in:
ಠ_ಠ 2019-02-13 01:18:32 +01:00 committed by Irina Truong
parent 484abb6530
commit bd0aaefdd2
3 changed files with 17 additions and 2 deletions

View File

@ -89,6 +89,7 @@ Contributors:
* Ignacio Campabadal * Ignacio Campabadal
* Mikhail Elovskikh (wronglink) * Mikhail Elovskikh (wronglink)
* Marcin Cieślak (saper) * Marcin Cieślak (saper)
* easteregg
Creator: Creator:
-------- --------

View File

@ -1,6 +1,11 @@
Upcoming: Upcoming:
========= =========
Features:
---------
* keybindings for closing the autocomplete list
Bug fixes: Bug fixes:
---------- ----------
* Avoid error message on the server side if hstore extension is not installed in the current database (#991). (Thanks: `Marcin Cieślak`_) * Avoid error message on the server side if hstore extension is not installed in the current database (#991). (Thanks: `Marcin Cieślak`_)

View File

@ -41,6 +41,16 @@ def pgcli_bindings(pgcli):
else: else:
b.start_completion(select_first=True) b.start_completion(select_first=True)
@kb.add('escape')
def _(event):
"""Force closing of autocompletion."""
_logger.debug('Detected <Esc> key.')
event.current_buffer.complete_state = None
event.app.current_buffer.complete_state = None
@kb.add('c-space') @kb.add('c-space')
def _(event): def _(event):
""" """
@ -71,7 +81,6 @@ def pgcli_bindings(pgcli):
_logger.debug('Detected enter key.') _logger.debug('Detected enter key.')
event.current_buffer.complete_state = None event.current_buffer.complete_state = None
b = event.app.current_buffer event.app.current_buffer.complete_state = None
b.complete_state = None
return kb return kb