##// END OF EJS Templates
Tab key inserts four spaces at the start of the line...
Thomas Kluyver -
Show More
@@ -12,7 +12,7 b' from traitlets import Bool, Unicode, Dict'
12
12
13 from prompt_toolkit.completion import Completer, Completion
13 from prompt_toolkit.completion import Completer, Completion
14 from prompt_toolkit.enums import DEFAULT_BUFFER
14 from prompt_toolkit.enums import DEFAULT_BUFFER
15 from prompt_toolkit.filters import HasFocus, HasSelection
15 from prompt_toolkit.filters import HasFocus, HasSelection, Condition
16 from prompt_toolkit.history import InMemoryHistory
16 from prompt_toolkit.history import InMemoryHistory
17 from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop
17 from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop
18 from prompt_toolkit.interface import CommandLineInterface
18 from prompt_toolkit.interface import CommandLineInterface
@@ -136,6 +136,21 b' class TerminalInteractiveShell(InteractiveShell):'
136 def _(event):
136 def _(event):
137 event.current_buffer.reset()
137 event.current_buffer.reset()
138
138
139 @Condition
140 def cursor_in_leading_ws(cli):
141 before = cli.application.buffer.document.current_line_before_cursor
142 return (not before) or before.isspace()
143
144 # Ctrl+I == Tab
145 @kbmanager.registry.add_binding(Keys.ControlI,
146 filter=(HasFocus(DEFAULT_BUFFER)
147 & ~HasSelection()
148 & insert_mode
149 & cursor_in_leading_ws
150 ))
151 def _(event):
152 event.current_buffer.insert_text(' ' * 4)
153
139 # Pre-populate history from IPython's history database
154 # Pre-populate history from IPython's history database
140 history = InMemoryHistory()
155 history = InMemoryHistory()
141 last_cell = u""
156 last_cell = u""
General Comments 0
You need to be logged in to leave comments. Login now