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