mirror of
https://github.com/dbcli/pgcli
synced 2024-06-24 02:03:20 +00:00
Add key bindings to consistently move up and down in history (#1084)
This commit is contained in:
parent
f85642da67
commit
19c3e0eeb8
1
AUTHORS
1
AUTHORS
|
@ -99,6 +99,7 @@ Contributors:
|
|||
* Alexander Zawadzki
|
||||
* Pablo A. Bianchi (pabloab)
|
||||
* Sebastian Janko (sebojanko)
|
||||
* Pedro Ferrari (petobens)
|
||||
|
||||
Creator:
|
||||
--------
|
||||
|
|
|
@ -11,6 +11,7 @@ Bug fixes:
|
|||
|
||||
* Error connecting to PostgreSQL 12beta1 (#1058). (Thanks: `Irina Truong`_)
|
||||
* Empty query caused error message (Thanks: `Sebastian Janko`_)
|
||||
* History navigation bindings in multiline queries (#1004) (Thanks: `Pedro Ferrari`_)
|
||||
|
||||
2.1.1
|
||||
=====
|
||||
|
@ -995,3 +996,4 @@ Improvements:
|
|||
.. _`Telmo "Trooper"`: https://github.com/telmotrooper
|
||||
.. _`Alexander Zawadzki`: https://github.com/zadacka
|
||||
.. _`Sebastian Janko`: https://github.com/sebojanko
|
||||
.. _`Pedro Ferrari`: https://github.com/petobens
|
||||
|
|
|
@ -3,7 +3,11 @@ 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, has_completions
|
||||
from prompt_toolkit.filters import (
|
||||
completion_is_selected,
|
||||
has_completions,
|
||||
has_selection,
|
||||
)
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -96,4 +100,14 @@ def pgcli_bindings(pgcli):
|
|||
_logger.debug("Detected alt-enter key.")
|
||||
event.app.current_buffer.insert_text("\n")
|
||||
|
||||
@kb.add("c-p", filter=~has_selection)
|
||||
def _(event):
|
||||
"""Move up in history."""
|
||||
event.current_buffer.history_backward(count=event.arg)
|
||||
|
||||
@kb.add("c-n", filter=~has_selection)
|
||||
def _(event):
|
||||
"""Move down in history."""
|
||||
event.current_buffer.history_forward(count=event.arg)
|
||||
|
||||
return kb
|
||||
|
|
Loading…
Reference in New Issue
Block a user