MCPcopy Create free account
hub / github.com/ipython/ipython / newline_with_copy_margin

Function newline_with_copy_margin

IPython/terminal/shortcuts.py:209–229  ·  view source on GitHub ↗

DEPRECATED since IPython 6.0 See :any:`newline_autoindent_outer` for a replacement. Preserve margin and cursor position when using Control-O to insert a newline in EMACS mode

(event)

Source from the content-addressed store, hash-verified

207
208@undoc
209def newline_with_copy_margin(event):
210 """
211 DEPRECATED since IPython 6.0
212
213 See :any:`newline_autoindent_outer` for a replacement.
214
215 Preserve margin and cursor position when using
216 Control-O to insert a newline in EMACS mode
217 """
218 warnings.warn("`newline_with_copy_margin(event)` is deprecated since IPython 6.0. "
219 "see `newline_autoindent_outer(shell)(event)` for a replacement.",
220 DeprecationWarning, stacklevel=2)
221
222 b = event.current_buffer
223 cursor_start_pos = b.document.cursor_position_col
224 b.newline(copy_margin=True)
225 b.cursor_up(count=1)
226 cursor_end_pos = b.document.cursor_position_col
227 if cursor_start_pos != cursor_end_pos:
228 pos_diff = cursor_start_pos - cursor_end_pos
229 b.cursor_right(count=pos_diff)
230
231def newline_autoindent_outer(inputsplitter) -> Callable[..., None]:
232 """

Callers

nothing calls this directly

Calls 1

warnMethod · 0.80

Tested by

no test coverage detected