From 5b24b61b49a02657118af384ca3df69ebf4a461c Mon Sep 17 00:00:00 2001 From: Onur Ugur <101659248+OnurrUgur@users.noreply.github.com> Date: Wed, 2 Dec 2026 14:21:42 +0300 Subject: [PATCH] feat(editor): register caret movement and line start/end actions (#7465) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Up, Down, Left, Right, Line Start, Line End and their With Selection variants were handled by the editor's keys only, so they could not be bound in keymapOverrides, imported IDEA keymaps (EditorUp, EditorLineStart, …) or IdeaVim. They are now Editor Actions running the same CodeMirror commands as the keys (smart Home, sticky selection), enabled in text editors and the editable side of a diff, with no default shortcut. A user override now wins over a preset binding on the same keystroke even when the overridden action already appears in the preset. Fixes #7452 Co-authored-by: OnurrUgur <101659248+OnurrUgur@users.noreply.github.com> --- src/editor/core/actions.ts | 82 +++++- src/editor/core/caretMovementActions.test.ts | 283 +++++++++++++++++++ src/platform/ideaActions.ts | 12 + src/platform/keymap.ts | 27 +- src/platform/keymaps/ideaParity.test.ts | 13 + src/platform/keymaps/intellij-macos.ts | 12 + src/platform/keymaps/intellij-windows.ts | 12 + src/platform/keymaps/vscode-macos.ts | 12 + src/platform/locales/text/zh-TW.json | 12 + src/platform/locales/text/zh.json | 12 + 10 files changed, 467 insertions(+), 10 deletions(-) create mode 100644 src/editor/core/caretMovementActions.test.ts diff --git a/src/editor/core/actions.ts b/src/editor/core/actions.ts index ec87310733..db80b8e4c9 100644 --- a/src/editor/core/actions.ts +++ b/src/editor/core/actions.ts @@ -2,7 +2,21 @@ import { writeClipboardText } from "@/platform/clipboard"; import { EditorSelection, type EditorState } from "@codemirror/state"; import { EditorView } from "@codemirror/view"; -import { indentSelection, moveLineDown, moveLineUp } from "@codemirror/commands"; +import { + cursorCharLeft, + cursorCharRight, + cursorLineBoundaryBackward, + cursorLineBoundaryForward, + cursorLineStart, + indentSelection, + moveLineDown, + moveLineUp, + selectCharLeft, + selectCharRight, + selectLineBoundaryBackward, + selectLineBoundaryForward, + selectLineStart, +} from "@codemirror/commands"; import { foldEffect, syntaxTree, toggleFold } from "@codemirror/language"; import { acceptCompletion, completionStatus } from "@codemirror/autocomplete"; import { executeAction, registerActions, type Action } from "@/platform/actions"; @@ -112,10 +126,14 @@ import { isColumnMode, toggleColumnMode } from "./cm/columnMode"; import { cloneCaretAbove, cloneCaretBelow, + cursorLineDown, + cursorLineUp, moveDownAndScroll, moveDownAndScrollWithSelection, moveUpAndScroll, moveUpAndScrollWithSelection, + selectLineDown, + selectLineUp, } from "./cm/verticalMotion"; import { pasteAsPlainText, pasteFromHistory, unwrapAtCaret } from "./extras"; import { cyclicExpandWord } from "./wordCompletion"; @@ -885,6 +903,10 @@ export function registerEditorActions(): () => void { }); const edit = diffText(true); const caret = diffText(false); + const lineStart = (view: EditorView, select: boolean) => { + if (!editorPrefs().smartKeys.smartHome) return (select ? selectLineStart : cursorLineStart)(view); + return (select ? selectLineBoundaryBackward : cursorLineBoundaryBackward)(view); + }; const activePaneTab = () => { const s = useTabs.getState(); const pane = s.panes[s.activePane]; @@ -1203,6 +1225,64 @@ export function registerEditorActions(): () => void { edit("code.startNewLine", "Start New Line", (v) => startNewLine(v)), edit("code.startNewLineBefore", "Start New Line Before Current", (v) => startNewLineBefore(v)), edit("code.splitLine", "Split Line", (v) => splitLine(v)), + caret("editor.up", "Move Caret Up", (v) => (isStickySelection(v.state) ? selectLineUp : cursorLineUp)(v), { + category: "Editor Actions", + keywords: ["up", "cursorUp"], + }), + caret("editor.down", "Move Caret Down", (v) => (isStickySelection(v.state) ? selectLineDown : cursorLineDown)(v), { + category: "Editor Actions", + keywords: ["down", "cursorDown"], + }), + caret("editor.left", "Move Caret Left", (v) => (isStickySelection(v.state) ? selectCharLeft : cursorCharLeft)(v), { + category: "Editor Actions", + keywords: ["left", "cursorLeft"], + }), + caret( + "editor.right", + "Move Caret Right", + (v) => (isStickySelection(v.state) ? selectCharRight : cursorCharRight)(v), + { + category: "Editor Actions", + keywords: ["right", "cursorRight"], + }, + ), + caret("editor.lineStart", "Move Caret to Line Start", (v) => lineStart(v, isStickySelection(v.state)), { + category: "Editor Actions", + keywords: ["line start", "home", "cursorHome"], + }), + caret( + "editor.lineEnd", + "Move Caret to Line End", + (v) => (isStickySelection(v.state) ? selectLineBoundaryForward : cursorLineBoundaryForward)(v), + { + category: "Editor Actions", + keywords: ["line end", "end", "cursorEnd"], + }, + ), + caret("editor.upWithSelection", "Move Caret Up with Selection", (v) => selectLineUp(v), { + category: "Editor Actions", + keywords: ["up with selection", "cursorUpSelect"], + }), + caret("editor.downWithSelection", "Move Caret Down with Selection", (v) => selectLineDown(v), { + category: "Editor Actions", + keywords: ["down with selection", "cursorDownSelect"], + }), + caret("editor.leftWithSelection", "Move Caret Left with Selection", (v) => selectCharLeft(v), { + category: "Editor Actions", + keywords: ["left with selection", "cursorLeftSelect"], + }), + caret("editor.rightWithSelection", "Move Caret Right with Selection", (v) => selectCharRight(v), { + category: "Editor Actions", + keywords: ["right with selection", "cursorRightSelect"], + }), + caret("editor.lineStartWithSelection", "Move Caret to Line Start with Selection", (v) => lineStart(v, true), { + category: "Editor Actions", + keywords: ["line start with selection", "home", "cursorHomeSelect"], + }), + caret("editor.lineEndWithSelection", "Move Caret to Line End with Selection", (v) => selectLineBoundaryForward(v), { + category: "Editor Actions", + keywords: ["line end with selection", "end", "cursorEndSelect"], + }), caret("editor.scrollToCenter", "Scroll to Center", (v) => scrollToCenter(v), { category: "Editor Actions" }), caret("editor.scrollUp", "Scroll Up", (v) => scrollUp(v), { category: "Editor Actions" }), caret("editor.scrollDown", "Scroll Down", (v) => scrollDown(v), { category: "Editor Actions" }), diff --git a/src/editor/core/caretMovementActions.test.ts b/src/editor/core/caretMovementActions.test.ts new file mode 100644 index 0000000000..047ea08a5f --- /dev/null +++ b/src/editor/core/caretMovementActions.test.ts @@ -0,0 +1,283 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { EditorSelection, EditorState } from "@codemirror/state"; +import { EditorView } from "@codemirror/view"; +import { _setFocusedCellEditor } from "@/editor/api"; +import { matchActions } from "@/features/search/everywhere/model"; +import { resolveActionId } from "@/features/vim/rc"; +import { allActions, executeAction, getAction, registerAction } from "@/platform/actions"; +import { useContextKeys } from "@/platform/context"; +import { _resetI18nForTests, setLocale } from "@/platform/i18n"; +import { IDEA_ACTIONS } from "@/platform/ideaActions"; +import { parseIdeaKeymap } from "@/platform/ideaKeymap"; +import { installKeyboardDispatcher, normalizeBinding, PRESETS, useKeymap } from "@/platform/keymap"; +import { useProject } from "@/platform/project"; +import { registerEditorActions } from "./actions"; +import { stickySelectionField, toggleStickySelection } from "./cm/stickySelection"; +import { visibleGoalColumns } from "./cm/verticalMotion"; + +const ACTIONS = [ + ["editor.up", "EditorUp", "Move Caret Up"], + ["editor.down", "EditorDown", "Move Caret Down"], + ["editor.left", "EditorLeft", "Move Caret Left"], + ["editor.right", "EditorRight", "Move Caret Right"], + ["editor.lineStart", "EditorLineStart", "Move Caret to Line Start"], + ["editor.lineEnd", "EditorLineEnd", "Move Caret to Line End"], + ["editor.upWithSelection", "EditorUpWithSelection", "Move Caret Up with Selection"], + ["editor.downWithSelection", "EditorDownWithSelection", "Move Caret Down with Selection"], + ["editor.leftWithSelection", "EditorLeftWithSelection", "Move Caret Left with Selection"], + ["editor.rightWithSelection", "EditorRightWithSelection", "Move Caret Right with Selection"], + ["editor.lineStartWithSelection", "EditorLineStartWithSelection", "Move Caret to Line Start with Selection"], + ["editor.lineEndWithSelection", "EditorLineEndWithSelection", "Move Caret to Line End with Selection"], +] as const; + +let dispose: () => void; +let uninstall: (() => void) | null = null; +const views: EditorView[] = []; +const initialKeymap = useKeymap.getState(); +const initialSettings = useProject.getState().settings; + +function makeView(doc: string, anchor: number, head = anchor, readOnly = false): EditorView { + const view = new EditorView({ + state: EditorState.create({ + doc, + selection: EditorSelection.range(anchor, head), + extensions: [visibleGoalColumns, stickySelectionField, ...(readOnly ? [EditorState.readOnly.of(true)] : [])], + }), + parent: document.body, + }); + views.push(view); + return view; +} + +beforeEach(() => { + dispose = registerEditorActions(); + useContextKeys.setState({ textEditorActive: true, editorTextFocus: true }, true); +}); + +afterEach(() => { + uninstall?.(); + uninstall = null; + dispose(); + _setFocusedCellEditor(null); + while (views.length) { + const v = views.pop()!; + v.destroy(); + v.dom.remove(); + } + useContextKeys.setState({}, true); + useKeymap.setState({ + preset: initialKeymap.preset, + overrides: initialKeymap.overrides, + extensions: initialKeymap.extensions, + }); + useProject.setState({ settings: initialSettings }); + _resetI18nForTests(); +}); + +describe("Caret movement actions", () => { + it("registers all 12 actions in Editor Actions and makes them discoverable in Find Action", () => { + for (const [id, , title] of ACTIONS) { + expect(getAction(id)).toMatchObject({ title, category: "Editor Actions" }); + expect(getAction(id)?.hidden).not.toBe(true); + } + const search = (query: string) => + matchActions(allActions(), query, { isEnabled: () => true, recent: [] }).map((item) => item.id); + expect(search("Up")).toContain("editor.up"); + expect(search("Down")).toContain("editor.down"); + expect(search("Left")).toContain("editor.left"); + expect(search("Right")).toContain("editor.right"); + expect(search("Line Start")).toContain("editor.lineStart"); + expect(search("Line End")).toContain("editor.lineEnd"); + expect(search("Up with Selection")).toContain("editor.upWithSelection"); + expect(search("Down with Selection")).toContain("editor.downWithSelection"); + expect(search("Left with Selection")).toContain("editor.leftWithSelection"); + expect(search("Right with Selection")).toContain("editor.rightWithSelection"); + expect(search("Line Start with Selection")).toContain("editor.lineStartWithSelection"); + expect(search("Line End with Selection")).toContain("editor.lineEndWithSelection"); + }); + + it("maps IDEA action ids for IdeaVim and imported keymaps without default shortcuts", () => { + for (const [id, ideaId] of ACTIONS) { + expect(IDEA_ACTIONS[ideaId]).toBe(id); + expect(resolveActionId(ideaId)).toBe(id); + for (const keymap of Object.values(PRESETS)) expect(keymap[id] ?? []).toEqual([]); + } + + const xml = ` + + + + + + + + + + + + + `; + const parsed = parseIdeaKeymap(xml); + expect(parsed.unknownActions).toEqual([]); + expect(parsed.overrides["editor.up"]).toEqual([normalizeBinding("Meta+K")]); + expect(parsed.overrides["editor.lineStartWithSelection"]).toEqual([normalizeBinding("Meta+Shift+H")]); + expect(parsed.overrides["editor.lineEndWithSelection"]).toEqual([normalizeBinding("Meta+Shift+L")]); + }); + + it("moves and selects with Up, Down, Left, Right, Line Start and Line End", async () => { + const view = makeView("alpha\n beta\ngamma", 12); // " be|ta" + _setFocusedCellEditor(view); + + await executeAction("editor.left"); + expect(view.state.selection.main).toMatchObject({ anchor: 11, head: 11 }); + + await executeAction("editor.right"); + expect(view.state.selection.main).toMatchObject({ anchor: 12, head: 12 }); + + await executeAction("editor.up"); + expect(view.state.doc.lineAt(view.state.selection.main.head).number).toBe(1); + + await executeAction("editor.down"); + expect(view.state.selection.main).toMatchObject({ anchor: 12, head: 12 }); + + // Smart Home enabled: first goes to indentation, second to column 0. + useProject.setState({ settings: { ...initialSettings, editor: { smartKeys: { smartHome: true } } } }); + await executeAction("editor.lineStart"); + expect(view.state.selection.main).toMatchObject({ anchor: 10, head: 10 }); + await executeAction("editor.lineStart"); + expect(view.state.selection.main).toMatchObject({ anchor: 6, head: 6 }); + + await executeAction("editor.lineEnd"); + expect(view.state.selection.main).toMatchObject({ anchor: 14, head: 14 }); + + // Smart Home disabled: goes straight to column 0. + useProject.setState({ settings: { ...initialSettings, editor: { smartKeys: { smartHome: false } } } }); + await executeAction("editor.lineStart"); + expect(view.state.selection.main).toMatchObject({ anchor: 6, head: 6 }); + + await executeAction("editor.rightWithSelection"); + expect(view.state.selection.main).toMatchObject({ anchor: 6, head: 7 }); + + await executeAction("editor.lineEndWithSelection"); + expect(view.state.selection.main).toMatchObject({ anchor: 6, head: 14 }); + + await executeAction("editor.leftWithSelection"); + expect(view.state.selection.main).toMatchObject({ anchor: 6, head: 13 }); + + await executeAction("editor.lineStartWithSelection"); + expect(view.state.selection.main).toMatchObject({ anchor: 6, head: 6 }); + + await executeAction("editor.downWithSelection"); + expect(view.state.doc.lineAt(view.state.selection.main.head).number).toBe(3); + expect(view.state.selection.main.anchor).toBe(6); + + await executeAction("editor.upWithSelection"); + expect(view.state.selection.main).toMatchObject({ anchor: 6, head: 6 }); + }); + + it("extends the selection on plain moves while sticky selection is active", async () => { + const view = makeView("first\n second", 10); // " se|cond" + _setFocusedCellEditor(view); + expect(toggleStickySelection(view)).toBe(true); + + await executeAction("editor.right"); + expect(view.state.selection.main).toMatchObject({ anchor: 10, head: 11 }); + + await executeAction("editor.lineEnd"); + expect(view.state.selection.main).toMatchObject({ anchor: 10, head: 14 }); + + await executeAction("editor.up"); + expect(view.state.selection.main.anchor).toBe(10); + expect(view.state.doc.lineAt(view.state.selection.main.head).number).toBe(1); + }); + + it("moves the caret on the focused diff pane (editable and read-only sides)", async () => { + const editable = makeView("one\ntwo", 5); // "t|wo" + const readonly = makeView("old\nnew", 5, 5, true); + useContextKeys.setState({ diffEditorFocus: true }, true); + + editable.focus(); + await executeAction("editor.up"); + expect(editable.state.selection.main).toMatchObject({ anchor: 1, head: 1 }); + + readonly.focus(); + await executeAction("editor.lineEnd"); + expect(readonly.state.selection.main).toMatchObject({ anchor: 7, head: 7 }); + }); + + it("replaces preset chords and conflicting preset bindings when overridden in keymapOverrides", async () => { + const view = makeView("line1\nline2", 8); // "li|ne2" + _setFocusedCellEditor(view); + + const copyPath = vi.fn(); + const hideActive = vi.fn(); + const commit = vi.fn(); + const cutLineEnd = vi.fn(); + const cleanup = [ + registerAction({ id: "editor.copyPath", title: "Copy Path", run: copyPath }), + registerAction({ id: "toolwindow.hideActive", title: "Hide Active", run: hideActive }), + registerAction({ id: "vcs.commit", title: "Commit", run: commit }), + registerAction({ + id: "code.cutLineEnd", + title: "Cut Line End", + keyWhen: "editorTextFocus || diffEditorFocus", + run: cutLineEnd, + }), + ]; + + try { + uninstall = installKeyboardDispatcher(window); + const press = (init: KeyboardEventInit) => + view.contentDOM.dispatchEvent(new KeyboardEvent("keydown", { bubbles: true, cancelable: true, ...init })); + + // VS Code (macOS): Meta+K starts chords (`Meta+K P` etc.), Meta+J is `toolwindow.hideActive`. + useKeymap.setState({ + preset: "vscode-macos", + overrides: { + "editor.up": ["Meta+K"], + "editor.down": ["Meta+J"], + }, + }); + press({ key: "k", code: "KeyK", metaKey: true }); + await Promise.resolve(); + expect(view.state.selection.main).toMatchObject({ anchor: 2, head: 2 }); + expect(copyPath).not.toHaveBeenCalled(); + + press({ key: "j", code: "KeyJ", metaKey: true }); + await Promise.resolve(); + expect(view.state.selection.main).toMatchObject({ anchor: 8, head: 8 }); + expect(hideActive).not.toHaveBeenCalled(); + + // IntelliJ (macOS): Meta+K is `vcs.commit` (listed after `editor.up`), Ctrl+K has `keyWhen`. + useKeymap.setState({ + preset: "intellij-macos", + overrides: { + "editor.up": ["Meta+K", "Ctrl+K"], + }, + }); + press({ key: "k", code: "KeyK", metaKey: true }); + await Promise.resolve(); + expect(view.state.selection.main).toMatchObject({ anchor: 2, head: 2 }); + expect(commit).not.toHaveBeenCalled(); + + // Move back down, then test overriding a keyWhen-gated preset shortcut (`Ctrl+K`). + await executeAction("editor.down"); + press({ key: "k", code: "KeyK", ctrlKey: true }); + await Promise.resolve(); + expect(view.state.selection.main).toMatchObject({ anchor: 2, head: 2 }); + expect(cutLineEnd).not.toHaveBeenCalled(); + } finally { + for (const fn of cleanup) fn(); + } + }); + + it.each([ + ["en", "Move Caret Up", "Move Caret to Line Start with Selection"], + ["zh", "将光标向上移动", "将光标移至行首并选择"], + ["zh-TW", "將游標向上移動", "將游標移至行首並選擇"], + ])("has searchable %s titles", async (locale, upTitle, lineStartSelTitle) => { + await setLocale(locale); + expect(getAction("editor.up")?.title).toBe(upTitle); + expect(getAction("editor.lineStartWithSelection")?.title).toBe(lineStartSelTitle); + }); +}); diff --git a/src/platform/ideaActions.ts b/src/platform/ideaActions.ts index 29888d0de5..12b7da1856 100644 --- a/src/platform/ideaActions.ts +++ b/src/platform/ideaActions.ts @@ -136,6 +136,18 @@ export const IDEA_ACTIONS: Readonly> = { ToggleZenMode: "view.toggleZenMode", EditorIncreaseFontSizeGlobal: "editor.increaseFontSizeAll", EditorDecreaseFontSizeGlobal: "editor.decreaseFontSizeAll", + EditorUp: "editor.up", + EditorDown: "editor.down", + EditorLeft: "editor.left", + EditorRight: "editor.right", + EditorLineStart: "editor.lineStart", + EditorLineEnd: "editor.lineEnd", + EditorUpWithSelection: "editor.upWithSelection", + EditorDownWithSelection: "editor.downWithSelection", + EditorLeftWithSelection: "editor.leftWithSelection", + EditorRightWithSelection: "editor.rightWithSelection", + EditorLineStartWithSelection: "editor.lineStartWithSelection", + EditorLineEndWithSelection: "editor.lineEndWithSelection", EditorDeleteLine: "code.deleteLine", EditorScrollUp: "editor.scrollUp", EditorScrollDown: "editor.scrollDown", diff --git a/src/platform/keymap.ts b/src/platform/keymap.ts index 0a495ce094..48426e0407 100644 --- a/src/platform/keymap.ts +++ b/src/platform/keymap.ts @@ -265,10 +265,14 @@ function cachedBindings() { bindingsCache.extensions === extensions ) return bindingsCache; - const merged: Keymap = { ...usableExtensionBindings(extensions), ...platformPreset(preset), ...overrides }; - const pairs = Object.entries(merged).flatMap(([id, keys]) => - keys.map((k) => [normalizeBinding(k), id] as [string, string]), - ); + const base: Keymap = { ...usableExtensionBindings(extensions), ...platformPreset(preset) }; + // Keep overridden actions after preset/extension entries even when the action id already exists in the preset, + // so user overrides win over preset bindings on the same keystroke. + const entries: Array<[string, string[]]> = [ + ...Object.entries(base).filter(([id]) => !Object.hasOwn(overrides, id)), + ...Object.entries(overrides), + ]; + const pairs = entries.flatMap(([id, keys]) => keys.map((k) => [normalizeBinding(k), id] as [string, string])); const hasWheel = pairs.some(([binding, id]) => isWheelBinding(binding) && supportsWheelShortcut(id)); bindingsCache = { preset, overrides, extensions, os, pairs, hasWheel }; return bindingsCache; @@ -893,18 +897,23 @@ export function installKeyboardDispatcher( // in the project view instead of reaching the Git log's Edit Commit // Message. An unmatching `keyWhen` fails the enablement check below, and // when no `keyWhen` matches, the preset/override order decides as before. + const { overrides } = useKeymap.getState(); + const isOverridden = (id: string) => Object.hasOwn(overrides, id); const keyWhenMatches = (id: string) => { const action = getAction(id); return !!action?.keyWhen && evaluateWhen(action.keyWhen, ctx); }; const ordered = exact.reverse(); - const preferred: string[] = []; - const fallback: string[] = []; + const overridePreferred: string[] = []; + const overrideFallback: string[] = []; + const presetPreferred: string[] = []; + const presetFallback: string[] = []; for (const id of ordered) { - if (keyWhenMatches(id)) preferred.push(id); - else fallback.push(id); + const specific = keyWhenMatches(id); + if (isOverridden(id)) (specific ? overridePreferred : overrideFallback).push(id); + else (specific ? presetPreferred : presetFallback).push(id); } - for (const id of [...preferred, ...fallback]) { + for (const id of [...overridePreferred, ...overrideFallback, ...presetPreferred, ...presetFallback]) { const action = getAction(id); if (action && actionEnabledForKey(action, e) && (!restricted || isForwardableAction(id, e.target))) { e.preventDefault(); diff --git a/src/platform/keymaps/ideaParity.test.ts b/src/platform/keymaps/ideaParity.test.ts index 32afcd1b93..16c60d6bf8 100644 --- a/src/platform/keymaps/ideaParity.test.ts +++ b/src/platform/keymaps/ideaParity.test.ts @@ -136,6 +136,19 @@ describe("IDEA keymap parity", () => { // Back / Forward also carry the mouse side buttons (``). ["editor.codeBlockStartWithSelection", ["Meta+Alt+Shift+["], ["Ctrl+Shift+["]], ["editor.codeBlockEndWithSelection", ["Meta+Alt+Shift+]"], ["Ctrl+Shift+]"]], + // Plain caret moves and their With Selection variants stay unbound so CodeMirror handles arrows and Home/End by default. + ["editor.up", [], []], + ["editor.down", [], []], + ["editor.left", [], []], + ["editor.right", [], []], + ["editor.lineStart", [], []], + ["editor.lineEnd", [], []], + ["editor.upWithSelection", [], []], + ["editor.downWithSelection", [], []], + ["editor.leftWithSelection", [], []], + ["editor.rightWithSelection", [], []], + ["editor.lineStartWithSelection", [], []], + ["editor.lineEndWithSelection", [], []], // EditorForwardParagraph / EditorBackwardParagraph (and with Selection) have no shortcut. ["editor.paragraphForward", [], []], ["editor.paragraphBackward", [], []], diff --git a/src/platform/keymaps/intellij-macos.ts b/src/platform/keymaps/intellij-macos.ts index de3bbcdc63..3f02b51919 100644 --- a/src/platform/keymaps/intellij-macos.ts +++ b/src/platform/keymaps/intellij-macos.ts @@ -141,6 +141,18 @@ export const intellijMacos: Record = { "code.startNewLineBefore": ["Meta+Alt+Enter"], // Before the HTTP / SQL consoles' ⌘↵ (Run), which wins there. "code.splitLine": ["Meta+Enter"], + "editor.up": [], + "editor.down": [], + "editor.left": [], + "editor.right": [], + "editor.lineStart": [], + "editor.lineEnd": [], + "editor.upWithSelection": [], + "editor.downWithSelection": [], + "editor.leftWithSelection": [], + "editor.rightWithSelection": [], + "editor.lineStartWithSelection": [], + "editor.lineEndWithSelection": [], "editor.scrollToCenter": ["Ctrl+L"], "tree.scrollToCenter": [], "editor.scrollUp": [], diff --git a/src/platform/keymaps/intellij-windows.ts b/src/platform/keymaps/intellij-windows.ts index 4365bfbf0b..1db44465ea 100644 --- a/src/platform/keymaps/intellij-windows.ts +++ b/src/platform/keymaps/intellij-windows.ts @@ -142,6 +142,18 @@ export const intellijWindows: Record = { "code.startNewLineBefore": ["Ctrl+Alt+Enter"], // Before the HTTP / SQL consoles' Ctrl+Enter (Run), which wins there. "code.splitLine": ["Ctrl+Enter"], + "editor.up": [], + "editor.down": [], + "editor.left": [], + "editor.right": [], + "editor.lineStart": [], + "editor.lineEnd": [], + "editor.upWithSelection": [], + "editor.downWithSelection": [], + "editor.leftWithSelection": [], + "editor.rightWithSelection": [], + "editor.lineStartWithSelection": [], + "editor.lineEndWithSelection": [], "editor.scrollToCenter": ["Ctrl+M"], "tree.scrollToCenter": [], "editor.scrollUp": ["Ctrl+Up"], diff --git a/src/platform/keymaps/vscode-macos.ts b/src/platform/keymaps/vscode-macos.ts index 3d1801d7c5..236f9521ac 100644 --- a/src/platform/keymaps/vscode-macos.ts +++ b/src/platform/keymaps/vscode-macos.ts @@ -274,6 +274,18 @@ export const vscodeMacos: Record = { "editor.copyPath": ["Meta+K P"], "navigate.searchText": [], "code.splitLine": [], + "editor.up": [], + "editor.down": [], + "editor.left": [], + "editor.right": [], + "editor.lineStart": [], + "editor.lineEnd": [], + "editor.upWithSelection": [], + "editor.downWithSelection": [], + "editor.leftWithSelection": [], + "editor.rightWithSelection": [], + "editor.lineStartWithSelection": [], + "editor.lineEndWithSelection": [], "editor.scrollToCenter": [], "tree.scrollToCenter": [], "editor.scrollUp": [], diff --git a/src/platform/locales/text/zh-TW.json b/src/platform/locales/text/zh-TW.json index 7627cb3ddb..b56b85492c 100644 --- a/src/platform/locales/text/zh-TW.json +++ b/src/platform/locales/text/zh-TW.json @@ -720,6 +720,18 @@ "Move Down and Scroll with Selection": "向下移動並捲動並選擇", "Scroll to Top": "捲動到頂部", "Scroll to Bottom": "捲動到底部", + "Move Caret Up": "將游標向上移動", + "Move Caret Down": "將游標向下移動", + "Move Caret Left": "將游標向左移動", + "Move Caret Right": "將游標向右移動", + "Move Caret to Line Start": "將游標移至行首", + "Move Caret to Line End": "將游標移至行尾", + "Move Caret Up with Selection": "將游標向上移動並選擇", + "Move Caret Down with Selection": "將游標向下移動並選擇", + "Move Caret Left with Selection": "將游標向左移動並選擇", + "Move Caret Right with Selection": "將游標向右移動並選擇", + "Move Caret to Line Start with Selection": "將游標移至行首並選擇", + "Move Caret to Line End with Selection": "將游標移至行尾並選擇", "Move Caret to Page Top": "將游標移至頁面頂部", "Move Caret to Page Bottom": "將游標移至頁面底部", "Move Caret to Page Top with Selection": "將游標移至頁面頂部並選擇", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index 72c7005dfe..54120ededb 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -1172,6 +1172,18 @@ "Move Down and Scroll with Selection": "向下移动并滚动并选择", "Scroll to Top": "滚动到顶部", "Scroll to Bottom": "滚动到底部", + "Move Caret Up": "将光标向上移动", + "Move Caret Down": "将光标向下移动", + "Move Caret Left": "将光标向左移动", + "Move Caret Right": "将光标向右移动", + "Move Caret to Line Start": "将光标移至行首", + "Move Caret to Line End": "将光标移至行尾", + "Move Caret Up with Selection": "将光标向上移动并选择", + "Move Caret Down with Selection": "将光标向下移动并选择", + "Move Caret Left with Selection": "将光标向左移动并选择", + "Move Caret Right with Selection": "将光标向右移动并选择", + "Move Caret to Line Start with Selection": "将光标移至行首并选择", + "Move Caret to Line End with Selection": "将光标移至行尾并选择", "Move Caret to Page Top": "将光标移至页面顶部", "Move Caret to Page Bottom": "将光标移至页面底部", "Move Caret to Page Top with Selection": "将光标移至页面顶部并选择",