A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: j/k shouldn't make new cells in vim mode (#4210)
Akshay Agrawale7f9770a4bb9
diff --git a/frontend/src/components/editor/Cell.tsx b/frontend/src/components/editor/Cell.tsxindex 43afcbb36c..c83ac10381 100644--- a/frontend/src/components/editor/Cell.tsx+++ b/frontend/src/components/editor/Cell.tsx@@ -165,8 +165,10 @@ function useCellHotkeys(editorView.current?.focus();}},- "cell.focusDown": () => actions.moveToNextCell({ cellId, before: false }),- "cell.focusUp": () => actions.moveToNextCell({ cellId, before: true }),+ "cell.focusDown": () =>+ actions.moveToNextCell({ cellId, before: false, noCreate: true }),+ "cell.focusUp": () =>+ actions.moveToNextCell({ cellId, before: true, noCreate: true }),"cell.sendToBottom": () => actions.sendToBottom({ cellId }),"cell.sendToTop": () => actions.sendToTop({ cellId }),"cell.aiCompletion": () => {diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.tsindex 37eb7cb274..6f3c12af2f 100644--- a/frontend/src/core/cells/cells.ts+++ b/frontend/src/core/cells/cells.ts@@ -973,15 +973,18 @@ const {};}- const nextCellId = column.atOrThrow(nextCellIndex);- // Just focus, no state change- focusAndScrollCellIntoView({- cellId: nextCellId,- cell: state.cellHandles[nextCellId],- config: state.cellData[nextCellId].config,- codeFocus: before ? "bottom" : "top",- variableName: undefined,- });+ if (nextCellIndex !== -1) {+ // Don't wrap around from top to bottom+ const nextCellId = column.atOrThrow(nextCellIndex);+ // Just focus, no state change+ focusAndScrollCellIntoView({+ cellId: nextCellId,+ cell: state.cellHandles[nextCellId],+ config: state.cellData[nextCellId].config,+ codeFocus: before ? "bottom" : "top",+ variableName: undefined,+ });+ }return state;},scrollToTarget: (state) => {diff --git a/frontend/src/core/codemirror/cells/extensions.ts b/frontend/src/core/codemirror/cells/extensions.tsindex 8f7e38b281..abe04cb456 100644--- a/frontend/src/core/codemirror/cells/extensions.ts+++ b/frontend/src/core/codemirror/cells/extensions.ts@@ -140,7 +140,7 @@ function cellKeymaps(cellId: CellId, hotkeys: HotkeyProvider): Extension[] {if (isAtStartOfEditor(ev)) {const actions = ev.state.facet(cellActionsState);- actions.moveToNextCell({ cellId, before: true });+ actions.moveToNextCell({ cellId, before: true, noCreate: true });return true;}return false;@@ -159,7 +159,7 @@ function cellKeymaps(cellId: CellId, hotkeys: HotkeyProvider): Extension[] {if (isAtEndOfEditor(ev)) {const actions = ev.state.facet(cellActionsState);- actions.moveToNextCell({ cellId, before: false });+ actions.moveToNextCell({ cellId, before: false, noCreate: true });return true;}return false;@@ -171,7 +171,7 @@ function cellKeymaps(cellId: CellId, hotkeys: HotkeyProvider): Extension[] {stopPropagation: true,run: (ev) => {const actions = ev.state.facet(cellActionsState);- actions.moveToNextCell({ cellId, before: false });+ actions.moveToNextCell({ cellId, before: false, noCreate: true });return true;},},@@ -181,7 +181,7 @@ function cellKeymaps(cellId: CellId, hotkeys: HotkeyProvider): Extension[] {stopPropagation: true,run: (ev) => {const actions = ev.state.facet(cellActionsState);- actions.moveToNextCell({ cellId, before: true });+ actions.moveToNextCell({ cellId, before: true, noCreate: true });return true;},},diff --git a/frontend/src/core/codemirror/keymaps/vim.ts b/frontend/src/core/codemirror/keymaps/vim.tsindex ba2b653a09..d49b09ecf8 100644--- a/frontend/src/core/codemirror/keymaps/vim.ts+++ b/frontend/src/core/codemirror/keymaps/vim.ts@@ -26,7 +26,7 @@ export function vimKeymapExtension(): Extension[] {if (isAtEndOfEditor(ev, true) && isInVimNormalMode(ev)) {const actions = ev.state.facet(cellActionsState);const cellId = ev.state.facet(cellIdState);- actions.moveToNextCell({ cellId, before: false });+ actions.moveToNextCell({ cellId, before: false, noCreate: true });return true;}return false;@@ -40,7 +40,7 @@ export function vimKeymapExtension(): Extension[] {if (isAtStartOfEditor(ev) && isInVimNormalMode(ev)) {const actions = ev.state.facet(cellActionsState);const cellId = ev.state.facet(cellIdState);- actions.moveToNextCell({ cellId, before: true });+ actions.moveToNextCell({ cellId, before: true, noCreate: true });return true;}return false;