Show More
@@ -0,0 +1,2 b'' | |||||
|
1 | Pressing Ctrl-Z in the terminal debugger now suspends IPython, as it already | |||
|
2 | does in the main terminal prompt. |
@@ -1,13 +1,19 b'' | |||||
|
1 | import signal | |||
|
2 | import sys | |||
|
3 | ||||
1 | from IPython.core.debugger import Pdb |
|
4 | from IPython.core.debugger import Pdb | |
2 |
|
5 | |||
3 | from IPython.core.completer import IPCompleter |
|
6 | from IPython.core.completer import IPCompleter | |
4 | from .ptutils import IPythonPTCompleter |
|
7 | from .ptutils import IPythonPTCompleter | |
|
8 | from .shortcuts import suspend_to_bg | |||
5 |
|
9 | |||
|
10 | from prompt_toolkit.filters import Condition | |||
|
11 | from prompt_toolkit.keys import Keys | |||
|
12 | from prompt_toolkit.key_binding.manager import KeyBindingManager | |||
6 | from prompt_toolkit.token import Token |
|
13 | from prompt_toolkit.token import Token | |
7 | from prompt_toolkit.shortcuts import create_prompt_application |
|
14 | from prompt_toolkit.shortcuts import create_prompt_application | |
8 | from prompt_toolkit.interface import CommandLineInterface |
|
15 | from prompt_toolkit.interface import CommandLineInterface | |
9 | from prompt_toolkit.enums import EditingMode |
|
16 | from prompt_toolkit.enums import EditingMode | |
10 | import sys |
|
|||
11 |
|
17 | |||
12 |
|
18 | |||
13 | class TerminalPdb(Pdb): |
|
19 | class TerminalPdb(Pdb): | |
@@ -32,8 +38,14 b' class TerminalPdb(Pdb):' | |||||
32 | ) |
|
38 | ) | |
33 | self._ptcomp = IPythonPTCompleter(compl, patch_stdout=patch_stdout) |
|
39 | self._ptcomp = IPythonPTCompleter(compl, patch_stdout=patch_stdout) | |
34 |
|
40 | |||
|
41 | kbmanager = KeyBindingManager.for_prompt() | |||
|
42 | supports_suspend = Condition(lambda cli: hasattr(signal, 'SIGTSTP')) | |||
|
43 | kbmanager.registry.add_binding(Keys.ControlZ, filter=supports_suspend | |||
|
44 | )(suspend_to_bg) | |||
|
45 | ||||
35 | self._pt_app = create_prompt_application( |
|
46 | self._pt_app = create_prompt_application( | |
36 | editing_mode=getattr(EditingMode, self.shell.editing_mode.upper()), |
|
47 | editing_mode=getattr(EditingMode, self.shell.editing_mode.upper()), | |
|
48 | key_bindings_registry=kbmanager.registry, | |||
37 | history=self.shell.debugger_history, |
|
49 | history=self.shell.debugger_history, | |
38 | completer= self._ptcomp, |
|
50 | completer= self._ptcomp, | |
39 | enable_history_search=True, |
|
51 | enable_history_search=True, |
General Comments 0
You need to be logged in to leave comments.
Login now