Skip to content

Commit 1ae10ff

Browse files
committed
fix(tui): let keypad Home and End move the prompt cursor
The session prompt binds `input.buffer.home` and `input.buffer.end` to `none`, so NumPad Home and NumPad End (kitty `CSI 57423 u` / `CSI 57424 u`) do nothing while the caret is in the prompt. Plain Home and End move the caret, which makes the keypad keys look broken rather than unbound. Bind the two commands to `kphome` and `kpend`. These are buffer commands, not line commands: measured on a two-line prompt, plain Home lands at the start of the buffer, so the keypad key has to land there too.
1 parent e965774 commit 1ae10ff

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/tui/src/config/keybind.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ export const Definitions = {
223223
"input.visual.line.end": keybind("alt+e", "Move to end of visual line in input"),
224224
"input.select.visual.line.home": keybind("alt+shift+a", "Select to start of visual line in input"),
225225
"input.select.visual.line.end": keybind("alt+shift+e", "Select to end of visual line in input"),
226-
"input.buffer.home": keybind("none", "Move to start of buffer in input"),
227-
"input.buffer.end": keybind("none", "Move to end of buffer in input"),
226+
"input.buffer.home": keybind("kphome", "Move to start of buffer in input"),
227+
"input.buffer.end": keybind("kpend", "Move to end of buffer in input"),
228228
"input.select.buffer.home": keybind("shift+home", "Select to start of buffer in input"),
229229
"input.select.buffer.end": keybind("shift+end", "Select to end of buffer in input"),
230230
"input.delete.line": keybind("ctrl+shift+d", "Delete line in input"),

‎packages/tui/test/config-v2.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ test("preserves current navigation defaults", () => {
167167
expect(config.keybinds.get("session.message.previous")).toEqual([])
168168
expect(config.keybinds.get("session.message.user.next")).toEqual([])
169169
expect(config.keybinds.get("session.message.user.previous")).toEqual([])
170-
expect(config.keybinds.get("input.buffer.home")).toEqual([])
171-
expect(config.keybinds.get("input.buffer.end")).toEqual([])
170+
expect(config.keybinds.get("input.buffer.home")).toMatchObject([{ key: "kphome" }])
171+
expect(config.keybinds.get("input.buffer.end")).toMatchObject([{ key: "kpend" }])
172172
expect(config.keybinds.get("prompt.images.view")).toMatchObject([{ key: "<leader>i" }])
173173
})
174174

0 commit comments

Comments
 (0)