Show More
@@ -17,6 +17,9 b' from prompt_toolkit.shortcuts.prompt import PromptSession' | |||||
17 | from prompt_toolkit.enums import EditingMode |
|
17 | from prompt_toolkit.enums import EditingMode | |
18 | from prompt_toolkit.formatted_text import PygmentsTokens |
|
18 | from prompt_toolkit.formatted_text import PygmentsTokens | |
19 |
|
19 | |||
|
20 | from prompt_toolkit import __version__ as ptk_version | |||
|
21 | PTK3 = ptk_version.startswith('3.') | |||
|
22 | ||||
20 |
|
23 | |||
21 | class TerminalPdb(Pdb): |
|
24 | class TerminalPdb(Pdb): | |
22 | """Standalone IPython debugger.""" |
|
25 | """Standalone IPython debugger.""" | |
@@ -49,20 +52,23 b' class TerminalPdb(Pdb):' | |||||
49 | & ~cursor_in_leading_ws |
|
52 | & ~cursor_in_leading_ws | |
50 | ))(display_completions_like_readline) |
|
53 | ))(display_completions_like_readline) | |
51 |
|
54 | |||
52 | self.pt_app = PromptSession( |
|
55 | options = dict( | |
53 |
|
|
56 | message=(lambda: PygmentsTokens(get_prompt_tokens())), | |
54 |
|
|
57 | editing_mode=getattr(EditingMode, self.shell.editing_mode.upper()), | |
55 |
|
|
58 | key_bindings=kb, | |
56 |
|
|
59 | history=self.shell.debugger_history, | |
57 |
|
|
60 | completer=self._ptcomp, | |
58 |
|
|
61 | enable_history_search=True, | |
59 |
|
|
62 | mouse_support=self.shell.mouse_support, | |
60 |
|
|
63 | complete_style=self.shell.pt_complete_style, | |
61 |
|
|
64 | style=self.shell.style, | |
62 | inputhook=self.shell.inputhook, |
|
65 | color_depth=self.shell.color_depth, | |
63 | color_depth=self.shell.color_depth, |
|
|||
64 | ) |
|
66 | ) | |
65 |
|
67 | |||
|
68 | if not PTK3: | |||
|
69 | options['inputhook'] = self.inputhook | |||
|
70 | self.pt_app = PromptSession(**options) | |||
|
71 | ||||
66 | def cmdloop(self, intro=None): |
|
72 | def cmdloop(self, intro=None): | |
67 | """Repeatedly issue a prompt, accept input, parse an initial prefix |
|
73 | """Repeatedly issue a prompt, accept input, parse an initial prefix | |
68 | off the received input, and dispatch to action methods, passing them |
|
74 | off the received input, and dispatch to action methods, passing them |
General Comments 0
You need to be logged in to leave comments.
Login now