Repository navigation
Conversation
NumPad Home, End, PageUp and PageDown arrive as `kphome`, `kpend`, `kppageup` and `kppagedown` (kitty `CSI 57423 u`, `CSI 57424 u`, and `CSI 57421 u` / `CSI 57422 u`), while the session bindings list only the plain `home`, `end`, `pageup` and `pagedown`. The keypad key beside a working key therefore does nothing: pressing NumPad End in the transcript does not jump to the last message. List the keypad key beside the key it mirrors on `session.first`, `session.last`, `session.page.up` and `session.page.down`. Plain Home and End stay reserved for transcript navigation, so `input.buffer.home` and `input.buffer.end` keep their empty defaults.
There was a problem hiding this comment.
This fixes it in the transcript. Using the simulated model, I scrolled a long answer to the top and sent the kitty keypad sequences. On the base branch, NumPad End (CSI 57424 u) did nothing. With this PR it jumps to the last message, and NumPad Home and NumPad PageDown also work. The config and config-v2 tests pass, and tsc -b is clean for packages/tui.
Public API: no config keys or schema change. Only the default values of four existing keybinds gain an extra key, so existing user overrides keep working.
Binding the transcript commands rather than the prompt makes sense, since plain Home and End do nothing in the prompt either.
Not blocking: the dialog list bindings (dialog.select.home/end/page_up/page_down) and the diff viewer bindings (diff.first/last/page.up/page.down) still list only the plain keys, so the keypad keys still do nothing in dialogs and the diff viewer. You could mirror them here too or leave them for a follow-up.
For a fix this small, the new test and its comment aren't needed. They can be dropped to keep the change minimal.
Related: #58946
|
Both points checked rather than assumed, and I am declining both for now — say so if you disagree on either. The dialog and diff-viewer gap is real, and it is a deliberate follow-up. I confirmed it on the branch: I would rather keep the test. The red-before-green measurement in the description depends on it: with the four defaults reverted the test fails, with them it passes. Dropping it would leave the claim unverified in the repo, which is the part a later change to these defaults would want a guard on. If the concern is the comment above the test rather than the test itself, I can shorten that. Nothing in the diff changed for this reply; the head is still |


Issue for this PR
Closes #55533. The same bug was reported separately as #57113, already closed as a duplicate of #55533.
Type of change
What does this PR do?
Under the kitty keyboard protocol a terminal reports NumPad navigation keys as their own functional key codes.
@opentui/core0.6.8 decodes them askppageup(CSI 57421 u),kppagedown(CSI 57422 u),kphome(CSI 57423 u) andkpend(CSI 57424 u), and@opentui/keymapaccepts all four as named single-stroke keys — but no default binding claimed any of them. So the keypad key next to a working key was silently dropped: in a session, plainEndjumps to the last message and NumPadEnddoes nothing.This PR lists each keypad key beside the key it mirrors, in
packages/tui/src/config/keybind.ts:session.firstctrl+g,home,alt+homectrl+g,home,alt+home,kphomesession.lastctrl+alt+g,endctrl+alt+g,end,kpendsession.page.uppageup,ctrl+alt+bpageup,ctrl+alt+b,kppageupsession.page.downpagedown,ctrl+alt+fpagedown,ctrl+alt+f,kppagedownWhy the session navigation commands and not the prompt. These are the navigation keys whose plain counterpart already has exactly one meaning in the session view, and that meaning is transcript navigation. Plain
HomeandEndare deliberately reserved for the transcript:input.buffer.homeandinput.buffer.enddefault tonone, andconfig-v2.test.tsxpins that withreserves home and end for navigation. Binding the keypad keys to the buffer commands instead would give NumPad Home a different meaning from the plain Home key beside it, which is the split #55533 asks to be rid of. Users who want the prompt behaviour still get it from thekeybindsoverride the issue itself shows.Scope. The NumPad arrow keys are not included:
upanddownare shared by the prompt, history, dialogs and the session, so mirroring them changes far more than the reported End/Home/PageUp/PageDown case.alt+end(session.messages_last_user) is not mirrored either, since there is no natural keypad chord for it.An earlier PR of mine, #55870, proposed the same keypad mirrors; I closed it when the prompt half looked like the target. This PR is that direction, aimed at the transcript half #55533 actually reports.
How did you verify your code works?
mirrors plain navigation keys on the keypadinconfig-v2.test.tsxasserts, for each of the four commands, that the resolved bindings contain both the plain key and the keypad key. It runs againstresolve()fromsrc/config, the table the TUI loads (src/app.tsx).config.test.tsxpins the legacysrc/config/v1table, which only config migration still reads (packages/cli/src/config/migrate.ts), so it is unchanged by design.1 fail, 35 pass); with the change,config,config-v2andkeybindpass (37 pass, 0 fail).@opentui/core0.6.8 (functional-key table) and@opentui/keymap0.6.8 (named single-stroke key set), not from memory. The branch installs the versions the workspace catalog pins.tsc -bclean forpackages/tui;oxlintandprettier --checkclean on both changed files.^[[57424uwhile the binding never fires.Checklist
Added by the opencode bot (AI-generated).
Related: #58946