##// END OF EJS Templates
Merge pull request #9770 from gforsyth/master...
Matthias Bussonnier -
r22709:0c67401c merge
parent child Browse files
Show More
@@ -56,6 +56,10 b' def register_ipython_shortcuts(registry, shell):'
56 & cursor_in_leading_ws
56 & cursor_in_leading_ws
57 ))(indent_buffer)
57 ))(indent_buffer)
58
58
59 registry.add_binding(Keys.ControlO,
60 filter=(HasFocus(DEFAULT_BUFFER)
61 & EmacsInsertMode()))(newline_with_copy_margin)
62
59 if shell.display_completions == 'readlinelike':
63 if shell.display_completions == 'readlinelike':
60 registry.add_binding(Keys.ControlI,
64 registry.add_binding(Keys.ControlI,
61 filter=(HasFocus(DEFAULT_BUFFER)
65 filter=(HasFocus(DEFAULT_BUFFER)
@@ -144,6 +148,20 b' def suspend_to_bg(event):'
144 def indent_buffer(event):
148 def indent_buffer(event):
145 event.current_buffer.insert_text(' ' * 4)
149 event.current_buffer.insert_text(' ' * 4)
146
150
151 def newline_with_copy_margin(event):
152 """
153 Preserve margin and cursor position when using
154 Control-O to insert a newline in EMACS mode
155 """
156 b = event.current_buffer
157 cursor_start_pos = b.document.cursor_position_col
158 b.newline(copy_margin=True)
159 b.cursor_up(count=1)
160 cursor_end_pos = b.document.cursor_position_col
161 if cursor_start_pos != cursor_end_pos:
162 pos_diff = cursor_start_pos - cursor_end_pos
163 b.cursor_right(count=pos_diff)
164
147
165
148
166
149
167
General Comments 0
You need to be logged in to leave comments. Login now