##// END OF EJS Templates
Remove deprecated `newline_with_copy_margin` (#13949)...
Matthias Bussonnier -
r28125:113d2b09 merge
parent child Browse files
Show More
@@ -492,37 +492,10 b' def indent_buffer(event):'
492 event.current_buffer.insert_text(" " * 4)
492 event.current_buffer.insert_text(" " * 4)
493
493
494
494
495 @undoc
496 def newline_with_copy_margin(event):
497 """
498 DEPRECATED since IPython 6.0
499
500 See :any:`newline_autoindent_outer` for a replacement.
501
502 Preserve margin and cursor position when using
503 Control-O to insert a newline in EMACS mode
504 """
505 warnings.warn(
506 "`newline_with_copy_margin(event)` is deprecated since IPython 6.0. "
507 "see `newline_autoindent_outer(shell)(event)` for a replacement.",
508 DeprecationWarning,
509 stacklevel=2,
510 )
511
512 b = event.current_buffer
513 cursor_start_pos = b.document.cursor_position_col
514 b.newline(copy_margin=True)
515 b.cursor_up(count=1)
516 cursor_end_pos = b.document.cursor_position_col
517 if cursor_start_pos != cursor_end_pos:
518 pos_diff = cursor_start_pos - cursor_end_pos
519 b.cursor_right(count=pos_diff)
520
521
522 def newline_autoindent(event):
495 def newline_autoindent(event):
523 """Insert a newline after the cursor indented appropriately.
496 """Insert a newline after the cursor indented appropriately.
524
497
525 Fancier version of deprecated ``newline_with_copy_margin`` which should
498 Fancier version of former ``newline_with_copy_margin`` which should
526 compute the correct indentation of the inserted line. That is to say, indent
499 compute the correct indentation of the inserted line. That is to say, indent
527 by 4 extra space after a function definition, class definition, context
500 by 4 extra space after a function definition, class definition, context
528 manager... And dedent by 4 space after ``pass``, ``return``, ``raise ...``.
501 manager... And dedent by 4 space after ``pass``, ``return``, ``raise ...``.
General Comments 0
You need to be logged in to leave comments. Login now