##// END OF EJS Templates
Backport PR #10305: Respect completions display style in terminal debugger...
Min RK -
r23385:66bc9c09 auto-backport-of-...
parent child Browse files
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
@@ -43,6 +46,15 b' class TerminalPdb(Pdb):'
43 kbmanager.registry.add_binding(Keys.ControlZ, filter=supports_suspend
46 kbmanager.registry.add_binding(Keys.ControlZ, filter=supports_suspend
44 )(suspend_to_bg)
47 )(suspend_to_bg)
45
48
49 if self.shell.display_completions == 'readlinelike':
50 kbmanager.registry.add_binding(Keys.ControlI,
51 filter=(HasFocus(DEFAULT_BUFFER)
52 & ~HasSelection()
53 & ViInsertMode() | EmacsInsertMode()
54 & ~cursor_in_leading_ws
55 ))(display_completions_like_readline)
56 multicolumn = (self.shell.display_completions == 'multicolumn')
57
46 self._pt_app = create_prompt_application(
58 self._pt_app = create_prompt_application(
47 editing_mode=getattr(EditingMode, self.shell.editing_mode.upper()),
59 editing_mode=getattr(EditingMode, self.shell.editing_mode.upper()),
48 key_bindings_registry=kbmanager.registry,
60 key_bindings_registry=kbmanager.registry,
@@ -50,7 +62,8 b' class TerminalPdb(Pdb):'
50 completer= self._ptcomp,
62 completer= self._ptcomp,
51 enable_history_search=True,
63 enable_history_search=True,
52 mouse_support=self.shell.mouse_support,
64 mouse_support=self.shell.mouse_support,
53 get_prompt_tokens=get_prompt_tokens
65 get_prompt_tokens=get_prompt_tokens,
66 display_completions_in_columns=multicolumn,
54 )
67 )
55 self.pt_cli = CommandLineInterface(self._pt_app, eventloop=self.shell._eventloop)
68 self.pt_cli = CommandLineInterface(self._pt_app, eventloop=self.shell._eventloop)
56
69
General Comments 0
You need to be logged in to leave comments. Login now