##// END OF EJS Templates
Respect completions display style in terminal debugger...
Thomas Kluyver -
Show More
@@ -5,11 +5,14 b' from IPython.core.debugger import Pdb'
5
5
6 from IPython.core.completer import IPCompleter
6 from IPython.core.completer import IPCompleter
7 from .ptutils import IPythonPTCompleter
7 from .ptutils import IPythonPTCompleter
8 from .shortcuts import suspend_to_bg
8 from .shortcuts import suspend_to_bg, cursor_in_leading_ws
9
9
10 from prompt_toolkit.filters import Condition
10 from prompt_toolkit.enums import DEFAULT_BUFFER
11 from prompt_toolkit.filters import (Condition, HasFocus, HasSelection,
12 ViInsertMode, EmacsInsertMode)
11 from prompt_toolkit.keys import Keys
13 from prompt_toolkit.keys import Keys
12 from prompt_toolkit.key_binding.manager import KeyBindingManager
14 from prompt_toolkit.key_binding.manager import KeyBindingManager
15 from prompt_toolkit.key_binding.bindings.completion import display_completions_like_readline
13 from prompt_toolkit.token import Token
16 from prompt_toolkit.token import Token
14 from prompt_toolkit.shortcuts import create_prompt_application
17 from prompt_toolkit.shortcuts import create_prompt_application
15 from prompt_toolkit.interface import CommandLineInterface
18 from prompt_toolkit.interface import CommandLineInterface
@@ -42,6 +45,15 b' class TerminalPdb(Pdb):'
42 kbmanager.registry.add_binding(Keys.ControlZ, filter=supports_suspend
45 kbmanager.registry.add_binding(Keys.ControlZ, filter=supports_suspend
43 )(suspend_to_bg)
46 )(suspend_to_bg)
44
47
48 if self.shell.display_completions == 'readlinelike':
49 kbmanager.registry.add_binding(Keys.ControlI,
50 filter=(HasFocus(DEFAULT_BUFFER)
51 & ~HasSelection()
52 & ViInsertMode() | EmacsInsertMode()
53 & ~cursor_in_leading_ws
54 ))(display_completions_like_readline)
55 multicolumn = (self.shell.display_completions == 'multicolumn')
56
45 self._pt_app = create_prompt_application(
57 self._pt_app = create_prompt_application(
46 editing_mode=getattr(EditingMode, self.shell.editing_mode.upper()),
58 editing_mode=getattr(EditingMode, self.shell.editing_mode.upper()),
47 key_bindings_registry=kbmanager.registry,
59 key_bindings_registry=kbmanager.registry,
@@ -49,7 +61,8 b' class TerminalPdb(Pdb):'
49 completer= self._ptcomp,
61 completer= self._ptcomp,
50 enable_history_search=True,
62 enable_history_search=True,
51 mouse_support=self.shell.mouse_support,
63 mouse_support=self.shell.mouse_support,
52 get_prompt_tokens=get_prompt_tokens
64 get_prompt_tokens=get_prompt_tokens,
65 display_completions_in_columns=multicolumn,
53 )
66 )
54 self.pt_cli = CommandLineInterface(self._pt_app, eventloop=self.shell._eventloop)
67 self.pt_cli = CommandLineInterface(self._pt_app, eventloop=self.shell._eventloop)
55
68
General Comments 0
You need to be logged in to leave comments. Login now