Allow selection of Ctrl-R search results

This may be an issue upstream in PTK or it might be because we override
all sorts of keybindings to allow for a friendlier multiline experience.

In any case, registering an explicit keybinding to break out of the
search mode restores the functionality.
This commit is contained in:
Gil Forsyth 2018-08-27 16:26:56 -04:00
parent 10774002e5
commit 21c7388ea1

View file

@ -2,9 +2,10 @@
"""Key bindings for prompt_toolkit xonsh shell."""
import builtins
from prompt_toolkit import search
from prompt_toolkit.enums import DEFAULT_BUFFER
from prompt_toolkit.filters import (Condition, IsMultiline, HasSelection,
EmacsInsertMode, ViInsertMode)
EmacsInsertMode, ViInsertMode, IsSearching)
from prompt_toolkit.keys import Keys
from prompt_toolkit.application.current import get_app
@ -339,6 +340,11 @@ def load_xonsh_bindings(key_bindings):
b.cursor_left(count=abs(relative_begin_index))
b.cursor_down(count=1)
@handle(Keys.ControlM, filter=IsSearching())
@handle(Keys.ControlJ, filter=IsSearching())
def accept_search(event):
search.accept_search()
@handle(Keys.ControlI, filter=insert_mode)
def generate_completions(event):
"""