Skip to content

Commit 6582eb5

Browse files
CopilotYoyokrazy
andauthored
Fix down arrow navigation in last notebook cell to move cursor to end of line (microsoft#251156)
* Initial plan for issue * Fix down arrow navigation in last notebook cell to move cursor to end of line Co-authored-by: Yoyokrazy <[email protected]> * Add test to validate cursor position logic for last cell arrow navigation Co-authored-by: Yoyokrazy <[email protected]> * Fix notebook down arrow navigation logic to move cursor to end of line Co-authored-by: Yoyokrazy <[email protected]> * Implement proper down arrow navigation logic based on feedback - Check NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY context key - Only move to end of line when cursor boundary is 'start' or 'none' - Use ICellViewModel's setSelections method for cursor positioning - Apply logic to any cell on last line, not just last cell - Preserve existing behavior for last cell navigation Co-authored-by: Yoyokrazy <[email protected]> * holy overthinking copilot --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Yoyokrazy <[email protected]> Co-authored-by: Michael Lively <[email protected]>
1 parent f62c722 commit 6582eb5

File tree

1 file changed

+9
-1
lines changed
  • src/vs/workbench/contrib/notebook/browser/contrib/navigation

1 file changed

+9
-1
lines changed

src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { InlineChatController } from '../../../../inlineChat/browser/inlineChatC
2121
import { CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION } from '../../controller/chat/notebookChatContext.js';
2222
import { INotebookActionContext, INotebookCellActionContext, NotebookAction, NotebookCellAction, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, findTargetCellEditor } from '../../controller/coreActions.js';
2323
import { CellEditState } from '../../notebookBrowser.js';
24-
import { CellKind, NOTEBOOK_EDITOR_CURSOR_BOUNDARY } from '../../../common/notebookCommon.js';
24+
import { CellKind, NOTEBOOK_EDITOR_CURSOR_BOUNDARY, NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY } from '../../../common/notebookCommon.js';
2525
import { NOTEBOOK_CELL_HAS_OUTPUTS, NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, NOTEBOOK_CELL_TYPE, NOTEBOOK_CURSOR_NAVIGATION_MODE, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_OUTPUT_INPUT_FOCUSED, NOTEBOOK_OUTPUT_FOCUSED, NOTEBOOK_CELL_EDITOR_FOCUSED, IS_COMPOSITE_NOTEBOOK } from '../../../common/notebookContextKeys.js';
2626

2727
const NOTEBOOK_FOCUS_TOP = 'notebook.focusTop';
@@ -77,6 +77,10 @@ registerAction2(class FocusNextCellAction extends NotebookCellAction {
7777
EditorContextKeys.editorTextFocus,
7878
NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top'),
7979
NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none'),
80+
ContextKeyExpr.or(
81+
NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY.isEqualTo('end'),
82+
NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY.isEqualTo('both')
83+
)
8084
),
8185
EditorContextKeys.isEmbeddedDiffEditor.negate()
8286
),
@@ -158,6 +162,10 @@ registerAction2(class FocusPreviousCellAction extends NotebookCellAction {
158162
EditorContextKeys.editorTextFocus,
159163
NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('bottom'),
160164
NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none'),
165+
ContextKeyExpr.or(
166+
NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY.isEqualTo('start'),
167+
NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY.isEqualTo('both')
168+
)
161169
),
162170
EditorContextKeys.isEmbeddedDiffEditor.negate()
163171
),

0 commit comments

Comments
 (0)