Show More
@@ -16,7 +16,7 b' from IPython.utils.process import abbrev_cwd' | |||||
16 | from traitlets import Bool, CBool, Unicode, Dict |
|
16 | from traitlets import Bool, CBool, Unicode, Dict | |
17 |
|
17 | |||
18 | from prompt_toolkit.completion import Completer, Completion |
|
18 | from prompt_toolkit.completion import Completer, Completion | |
19 | from prompt_toolkit.enums import DEFAULT_BUFFER |
|
19 | from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER | |
20 | from prompt_toolkit.filters import HasFocus, HasSelection, Condition |
|
20 | from prompt_toolkit.filters import HasFocus, HasSelection, Condition | |
21 | from prompt_toolkit.history import InMemoryHistory |
|
21 | from prompt_toolkit.history import InMemoryHistory | |
22 | from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop |
|
22 | from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop | |
@@ -182,6 +182,13 b' class TerminalInteractiveShell(InteractiveShell):' | |||||
182 | def _(event): |
|
182 | def _(event): | |
183 | event.current_buffer.reset() |
|
183 | event.current_buffer.reset() | |
184 |
|
184 | |||
|
185 | @kbmanager.registry.add_binding(Keys.ControlC, filter=HasFocus(SEARCH_BUFFER)) | |||
|
186 | def _(event): | |||
|
187 | if event.current_buffer.document.text: | |||
|
188 | event.current_buffer.reset() | |||
|
189 | else: | |||
|
190 | event.cli.push_focus(DEFAULT_BUFFER) | |||
|
191 | ||||
185 | supports_suspend = Condition(lambda cli: hasattr(signal, 'SIGTSTP')) |
|
192 | supports_suspend = Condition(lambda cli: hasattr(signal, 'SIGTSTP')) | |
186 |
|
193 | |||
187 | @kbmanager.registry.add_binding(Keys.ControlZ, filter=supports_suspend) |
|
194 | @kbmanager.registry.add_binding(Keys.ControlZ, filter=supports_suspend) |
General Comments 0
You need to be logged in to leave comments.
Login now