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)
| 207 | |
| 208 | @undoc |
| 209 | def 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 | |
| 231 | def newline_autoindent_outer(inputsplitter) -> Callable[..., None]: |
| 232 | """ |