Skip to content

Commit 0ca6056

Browse files
author
SqlRush
committed
Accept editor navigation action aliases
1 parent 87d53d4 commit 0ca6056

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

docs/claude-code-go-rewrite-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ test/parity/ # golden tests against TS/official behavior
347347
- 本轮补充:keybinding config、keymap 解析和 interaction script named-key 输入接受 `ctrl-h`/`ctrl-i`/`ctrl-j`/`ctrl-m`、`ctrl-[`、`ctrl-?`、对应 `control-*` 以及 compact/camel 形式;terminal parser 支持 CSI-u/kitty keyboard protocol 的 ctrl/alt/shift-enter/shift-tab 序列;image hint parser 支持 OSC ST terminator 和 base64 `name=` filename;keybinding JSON loader 支持 wrapper object-map、`shortcuts`、object action 字段、string-array key sequence/chord 和 `null`/`false` unbind;mouse parser 支持 legacy X10/normal tracking 序列;interaction script 支持结构化 mouse/mouse_event 步骤,button 接受 `buttonMask`/`button_mask`/`btn`/`code`/`mask`,坐标接受 `mouseX`/`mouse_x`/`clientX`/`screenX`/`pageX`/`offsetX`/`viewportX` 和对应 Y/row/line 别名,release 接受 `mouseUp`/`isRelease`/`mouseRelease`/`releaseEvent` 等字段别名;interaction script 还支持字符串 `keys` 和 `input`/`input_text`/`keys_text`/`raw_key`/`paste_text` 字段别名,并允许 status/snapshot/viewport/pasted-content contains 断言使用单字符串或字符串数组,`keybindings`、`expectEvents`、`expectDialogResults`、`expectPrompt.pastedContents` 和 `expectTasks.contains` 使用单对象或对象数组。
348348
- 本轮补充:keybinding config 的 page/navigation/editing key name 现在接受 `pgup`/`pg-up`/`prior`/`pageUpKey``pgdn`/`pg-down`/`next`/`pageDownKey``homeKey`/`endKey``deleteForward`/`forwardDelete``deleteBackward`,覆盖常见终端、DOM 和配置别名。
349349
- 本轮补充:keybinding config 和脚本 named-key 输入接受 DOM-style arrow key aliases,包括 `arrowLeft`/`arrowRight`/`arrowUp`/`arrowDown` 以及 ctrl/alt/meta/option arrow variants。
350-
- 本轮补充:keybinding action parser 接受更多 editor/global-style action aliases,包括 `cursorLeft`/`cursorRight``lineStart`/`lineEnd``deletePreviousChar`/`deleteNextChar``backwardDelete`/`forwardDelete``killLine``pasteKillRing`/`yankPrevious``clearScreen``openExternalEditor``toggleTasks``cancelAgents``focusPrev``acceptSelection``search`
350+
- 本轮补充:keybinding action parser 接受更多 editor/global-style action aliases,包括 `cursorLeft`/`cursorRight``previousWord`/`nextWord``lineStart`/`lineEnd``moveToBeginningOfLine`/`moveToEndOfLine``deletePreviousChar`/`deleteNextChar``backwardDelete`/`forwardDelete``deleteToStartOfLine`/`deleteToEndOfLine``killLine``pasteKillRing`/`yankPrevious``clearScreen``openExternalEditor``toggleTasks``cancelAgents``focusPrev``acceptSelection``search`
351351
- 本轮补充:keybinding config 和脚本 named-key 输入接受短修饰符别名,包括 `c-`/`m-`/`a-`/`opt-`/`s-` 以及 compact/camel 形式,可覆盖 control、meta、alt、option 和 shift key names。
352352
- 本轮补充:keybinding config 和脚本 named-key 输入现在接受 `backtab`/`back-tab`/`btab` 等 Shift-Tab terminfo/fixture 别名,并映射到既有 focus-previous key surface。
353353
- 本轮补充:keybinding JSON loader 现在递归解包 `data`/`payload`/`settings`/`config`/`keyboard`/`keymap` 等外层 wrapper,嵌套 preference export 中的 `bindings`/`shortcuts` 不需要手工扁平化。

docs/first-second-parity-audit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ M7 progress now includes:
343343
- `internal/tui`: keybinding config, keymap resolution, and interaction script named-key input now accept terminal aliases for `ctrl-h`/`ctrl-i`/`ctrl-j`/`ctrl-m`, `ctrl-[`, and `ctrl-?`, including `control-*` and compact/camel variants.
344344
- `internal/tui`: keybinding config now accepts page/navigation/editing aliases such as `pgup`, `pg-up`, `prior`, `pageUpKey`, `pgdn`, `pg-down`, `next`, `pageDownKey`, `homeKey`, `endKey`, `deleteForward`, `forwardDelete`, and `deleteBackward`.
345345
- `internal/tui`: keybinding config and named-key script input now accept DOM-style arrow key aliases such as `arrowLeft`, `arrowRight`, `arrowUp`, `arrowDown`, and modifier-arrow variants.
346-
- `internal/tui`: keybinding action parsing now accepts broader editor/global-style aliases such as `cursorLeft`, `lineStart`, `deletePreviousChar`, `deleteNextChar`, `backwardDelete`, `forwardDelete`, `killLine`, `pasteKillRing`, `clearScreen`, `openExternalEditor`, `toggleTasks`, `cancelAgents`, `focusPrev`, `acceptSelection`, and `search`.
346+
- `internal/tui`: keybinding action parsing now accepts broader editor/global-style aliases such as `cursorLeft`, `previousWord`, `nextWord`, `lineStart`, `lineEnd`, `moveToBeginningOfLine`, `moveToEndOfLine`, `deletePreviousChar`, `deleteNextChar`, `backwardDelete`, `forwardDelete`, `deleteToStartOfLine`, `deleteToEndOfLine`, `killLine`, `pasteKillRing`, `clearScreen`, `openExternalEditor`, `toggleTasks`, `cancelAgents`, `focusPrev`, `acceptSelection`, and `search`.
347347
- `internal/tui`: keybinding config and named-key script input now accept short modifier aliases such as `c-left`, `cA`, `m-b`, `a-right`, `optF`, `s-tab`, and `sEnter`.
348348
- `internal/tui`: keybinding config and named-key script input now accept Shift-Tab terminfo aliases such as `backtab`, `back-tab`, and `btab`, mapping them to the existing focus-previous key surface.
349349
- `internal/tui`: scripted interaction `keys` entries now accept printable text chunks and whitespace-separated named key sequences such as `ctrl-x ctrl-k`.

internal/tui/keybinding_config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,21 +390,21 @@ func ParseActionName(raw string) (Action, error) {
390390
return ActionMoveLeft, nil
391391
case "right", "cursor_right", "forward", "move_forward":
392392
return ActionMoveRight, nil
393-
case "word_left", "word_backward", "backward_word", "move_word_backward":
393+
case "word_left", "word_backward", "backward_word", "previous_word", "prev_word", "move_word_backward", "move_to_previous_word":
394394
return ActionMoveWordLeft, nil
395-
case "word_right", "word_forward", "forward_word", "move_word_forward":
395+
case "word_right", "word_forward", "forward_word", "next_word", "move_word_forward", "move_to_next_word":
396396
return ActionMoveWordRight, nil
397-
case "home", "start", "line_start", "beginning", "move_to_start":
397+
case "home", "start", "line_start", "beginning", "beginning_of_line", "start_of_line", "move_to_start", "move_to_line_start", "move_to_beginning", "move_to_beginning_of_line":
398398
return ActionMoveStart, nil
399-
case "end", "line_end", "move_to_end":
399+
case "end", "line_end", "end_of_line", "move_to_end", "move_to_line_end", "move_to_end_of_line":
400400
return ActionMoveEnd, nil
401401
case "backspace", "delete_back", "delete_backward", "backward_delete", "delete_previous", "delete_previous_char", "delete_backward_char", "backward_delete_char":
402402
return ActionDeleteBackward, nil
403403
case "delete", "del", "delete_forward", "forward_delete", "delete_next", "delete_next_char", "delete_forward_char", "forward_delete_char":
404404
return ActionDeleteForward, nil
405-
case "delete_start", "delete_line_start", "delete_to_beginning", "delete_to_line_start":
405+
case "delete_start", "delete_line_start", "delete_to_start", "delete_to_beginning", "delete_to_line_start", "delete_to_start_of_line", "delete_to_beginning_of_line":
406406
return ActionDeleteToStart, nil
407-
case "kill_line", "delete_line_end", "delete_to_line_end":
407+
case "kill_line", "delete_line_end", "delete_to_end", "delete_to_line_end", "delete_to_end_of_line":
408408
return ActionDeleteToEnd, nil
409409
case "delete_word_back", "delete_word_backward", "delete_word_left", "kill_word_backward", "backward_kill_word":
410410
return ActionDeleteWordBack, nil

internal/tui/tui_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,17 +1421,23 @@ func TestKeymapFromSpecsOverridesAndRemovesBindings(t *testing.T) {
14211421
{name: "cursorLeft", want: ActionMoveLeft},
14221422
{name: "cursorRight", want: ActionMoveRight},
14231423
{name: "wordBackward", want: ActionMoveWordLeft},
1424+
{name: "previousWord", want: ActionMoveWordLeft},
14241425
{name: "wordForward", want: ActionMoveWordRight},
1426+
{name: "nextWord", want: ActionMoveWordRight},
14251427
{name: "lineStart", want: ActionMoveStart},
1428+
{name: "moveToBeginningOfLine", want: ActionMoveStart},
14261429
{name: "lineEnd", want: ActionMoveEnd},
1430+
{name: "moveToEndOfLine", want: ActionMoveEnd},
14271431
{name: "deletePreviousChar", want: ActionDeleteBackward},
14281432
{name: "backwardDelete", want: ActionDeleteBackward},
14291433
{name: "backwardDeleteChar", want: ActionDeleteBackward},
14301434
{name: "deleteNextChar", want: ActionDeleteForward},
14311435
{name: "forwardDelete", want: ActionDeleteForward},
14321436
{name: "forwardDeleteChar", want: ActionDeleteForward},
14331437
{name: "deleteToBeginning", want: ActionDeleteToStart},
1438+
{name: "deleteToStartOfLine", want: ActionDeleteToStart},
14341439
{name: "killLine", want: ActionDeleteToEnd},
1440+
{name: "deleteToEndOfLine", want: ActionDeleteToEnd},
14351441
{name: "backwardKillWord", want: ActionDeleteWordBack},
14361442
{name: "killWord", want: ActionDeleteWordFwd},
14371443
{name: "historyPrevious", want: ActionHistoryPrevious},

0 commit comments

Comments
 (0)