##// END OF EJS Templates
FIX: Update vi bindings to work with nav auttosuggestion....
Matthias Bussonnier -
Show More
@@ -363,9 +363,9 b' def create_ipython_shortcuts(shell, for_all_platforms: bool = False) -> KeyBindi'
363 363 kb.add("c-right", filter=has_suggestion & has_focus(DEFAULT_BUFFER))(
364 364 auto_suggest.accept_token
365 365 )
366 kb.add("escape", filter=has_suggestion & has_focus(DEFAULT_BUFFER))(
367 auto_suggest.discard
368 )
366 kb.add(
367 "escape", filter=has_suggestion & has_focus(DEFAULT_BUFFER) & emacs_insert_mode
368 )(auto_suggest.discard)
369 369 kb.add(
370 370 "up",
371 371 filter=navigable_suggestions
@@ -451,7 +451,6 b' def create_ipython_shortcuts(shell, for_all_platforms: bool = False) -> KeyBindi'
451 451 if shell.editing_mode == "vi" and shell.modal_cursor:
452 452 ViState._input_mode = InputMode.INSERT # type: ignore
453 453 ViState.input_mode = property(get_input_mode, set_input_mode) # type: ignore
454
455 454 return kb
456 455
457 456
@@ -75,6 +75,7 b' class NavigableAutoSuggestFromHistory(AutoSuggestFromHistory):'
75 75 # note: `on_text_changed` could be used for a bit different behaviour
76 76 # on character deletion (i.e. reseting history position on backspace)
77 77 pt_app.default_buffer.on_text_insert.add_handler(self.reset_history_position)
78 pt_app.default_buffer.on_cursor_position_changed.add_handler(self._dismiss)
78 79
79 80 def get_suggestion(
80 81 self, buffer: Buffer, document: Document
@@ -89,6 +90,9 b' class NavigableAutoSuggestFromHistory(AutoSuggestFromHistory):'
89 90
90 91 return None
91 92
93 def _dismiss(self, buffer, *args, **kwargs):
94 buffer.suggestion = None
95
92 96 def _find_match(
93 97 self, text: str, skip_lines: float, history: History, previous: bool
94 98 ) -> Generator[Tuple[str, float], None, None]:
General Comments 0
You need to be logged in to leave comments. Login now