浏览代码

Backport PR #10884: Keep cursor at the previous position after cell split (#10888)

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
MeeseeksMachine 3 年之前
父节点
当前提交
2fcff98130
共有 2 个文件被更改,包括 4 次插入7 次删除
  1. 4 7
      packages/notebook/src/actions.tsx
  2. 二进制
      ui-tests/reference-output/screenshots/notebook_edit_split_cell.png

+ 4 - 7
packages/notebook/src/actions.tsx

@@ -129,16 +129,16 @@ export namespace NotebookActions {
   /**
    * Split the active cell into two or more cells.
    *
-   * @param widget - The target notebook widget.
+   * @param notebook The target notebook widget.
    *
    * #### Notes
    * It will preserve the existing mode.
    * The last cell will be activated if no selection is found.
    * If text was selected, the cell containing the selection will
-     be activated.
+   * be activated.
    * The existing selection will be cleared.
-   * The activated cell will have focus and the cursor will move
-     to the end of the cell.
+   * The activated cell will have focus and the cursor will
+   * remain in the initial position.
    * The leading whitespace in the second cell will be removed.
    * If there is no content, two empty cells will be created.
    * Both cells will have the same type as the original cell.
@@ -216,9 +216,6 @@ export namespace NotebookActions {
     const focusedEditor = notebook.activeCell.editor;
     focusedEditor.focus();
 
-    // Move to the end of the cell that now contains the cursor
-    focusedEditor.setCursorPosition({ line: editor.lineCount, column: 0 });
-
     Private.handleState(notebook, state);
   }
 

二进制
ui-tests/reference-output/screenshots/notebook_edit_split_cell.png