##// END OF EJS Templates
Only use our Enter handling when the default buffer is active...
Thomas Kluyver -
Show More
@@ -1,6 +1,8 b''
1 from IPython.core.interactiveshell import InteractiveShell
1 from IPython.core.interactiveshell import InteractiveShell
2
2
3 from prompt_toolkit.completion import Completer, Completion
3 from prompt_toolkit.completion import Completer, Completion
4 from prompt_toolkit.enums import DEFAULT_BUFFER
5 from prompt_toolkit.filters import HasFocus, HasSelection
4 from prompt_toolkit.history import InMemoryHistory
6 from prompt_toolkit.history import InMemoryHistory
5 from prompt_toolkit.shortcuts import create_prompt_application
7 from prompt_toolkit.shortcuts import create_prompt_application
6 from prompt_toolkit.interface import CommandLineInterface
8 from prompt_toolkit.interface import CommandLineInterface
@@ -46,7 +48,9 b' class PTInteractiveShell(InteractiveShell):'
46
48
47 def init_prompt_toolkit_cli(self):
49 def init_prompt_toolkit_cli(self):
48 kbmanager = KeyBindingManager.for_prompt()
50 kbmanager = KeyBindingManager.for_prompt()
49 @kbmanager.registry.add_binding(Keys.ControlJ) # Ctrl+J == Enter, seemingly
51 # Ctrl+J == Enter, seemingly
52 @kbmanager.registry.add_binding(Keys.ControlJ,
53 filter=HasFocus(DEFAULT_BUFFER) & ~HasSelection())
50 def _(event):
54 def _(event):
51 b = event.current_buffer
55 b = event.current_buffer
52 if not b.document.on_last_line:
56 if not b.document.on_last_line:
General Comments 0
You need to be logged in to leave comments. Login now