fix(opencode): restore Home/End prompt navigation in TUI#19135
fix(opencode): restore Home/End prompt navigation in TUI#19135AnttiJalomaki wants to merge 5 commits intoanomalyco:devfrom
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Whoah, sounds undesirable to me! I rely heavily upon these keys navigating the session and use the existing control+A and control+E keys for navigating the prompt. |
|
E2E failure on Windows (session model restore across workspaces) is a pre-existing flaky test — the dropdown select item gets detached mid-click due to animation timing. Our changes don't touch any of the affected app/E2E code. Linux E2E passes clean. Attached is video recording of Home, End, Shift+Home, Shift+End, Ctrl+Home, Ctrl+End, Pg Up, and Pg Down tests locally. |
6ab9431 to
32475b0
Compare
Current issueThe welcome screen (input field centered) already uses standard Home/End behavior for line navigation, but the main session view (input field at bottom) uses Home/End to jump through conversation history instead. This PR synchronizes both to use Why this should be the defaultHome/End for line navigation is the universal standard across:
Users expect Home/End to move the cursor within the current line. Using these keys for conversation navigation breaks muscle memory from every other text input they use. Keybinding overridesOpenCode already supports user-configurable keybindings, so both preferences are covered regardless of which default is chosen. If this PR is merged, users who prefer the current behavior (Home/End for conversation navigation) can restore it:
Without this PR, users who want standard Home/End behavior can already apply this override today: { The question is which default serves most users best out of the box. Given the universal convention, this PR aligns the defaults with what new users already expect. |
|
This seems like a sensible default to me, it is a very normal idiom and is widely implemented in many editors for the home and end buttons to move the cursor to the front and end of the current line being edited. |
Home/End now moves to start/end of line (matching VS Code's cursorHome/ cursorEnd and Visual Studio's Edit.LineStart/Edit.LineEnd). Buffer navigation moves to Ctrl+Home/Ctrl+End, consistent with how both editors handle document-level cursor movement. VS Code holds ~76% market share (Stack Overflow 2025) making its keybinding conventions the de facto standard for developer tools.
Updated: Home/End keybindings now match VS Code conventionsI updated the bindings commit to match closer VS Code. VS Code holds ~76% developer market share (Stack Overflow 2025), making its keybinding conventions the de facto standard.
If this commit is merged, users who prefer the previous behavior (Home/End for buffer start/end, Shift+Home/End for select-to-buffer) can restore it:
{
"keybinds": {
"input_line_home": "ctrl+a",
"input_line_end": "ctrl+e",
"input_select_line_home": "ctrl+shift+a",
"input_select_line_end": "ctrl+shift+e",
"input_buffer_home": "home",
"input_buffer_end": "end",
"input_select_buffer_home": "shift+home",
"input_select_buffer_end": "shift+end"
}
}Without this commit, users who want the VS Code–style Home/End behavior today can apply this override: {
"keybinds": {
"input_line_home": "ctrl+a,home",
"input_line_end": "ctrl+e,end",
"input_select_line_home": "ctrl+shift+a,shift+home",
"input_select_line_end": "ctrl+shift+e,shift+end",
"input_buffer_home": "ctrl+home",
"input_buffer_end": "ctrl+end",
"input_select_buffer_home": "ctrl+shift+home",
"input_select_buffer_end": "ctrl+shift+end"
}
} |
|
I was about to mention the line vs buffer discrepancy with the current default bindings for home and end on the initial prompt screen (and also in the session view), but it seems you figured that out on your own already. 👍 I'm not sure about the current behavior with |
|
Another berhavior that I understand but find annoying nonetheless is that using That, too, may be out of scope for this change, however. |
|
@FichteFoll Yes, both out of scope and IMO undesirable. |
|
@AnttiJalomaki This actually does not align with the behaviour of the keys in Emacs at all, where |
|
@ariane-emory Emacs was most popular in 1985, today it's VS Code. |
|
Per Stack Overflow Developer Survey 2025, three keymap families dominate developer muscle memory: VS Code-family ~76%, Vim ~38%, and Emacs ~4%. A keybinding theme switcher (similar to Claude Code's) covering these three would match ~95% of developers. JetBrains/IntelliJ keymap (~27% usage) would be the most defensible 4th option. I am not here trying to undermine your keybinding preferences @ariane-emory, but to cater to a wider userbase with a simple mechanism rather than picking one default that locks out the others. A theme switcher keeps Emacs bindings as-is, with no regression for current users. It would give VS Code and Vim bindings users a path in without forking config. My proposal would grow muscle memory catering from ~4% to ~95%. I could have a go at the implementation if people feel it would be reasonable. |
Issue for this PR
Closes #14899
Type of change
What does this PR do?
In the TUI, Home and End keys were mistakenly assigned to session navigation, so pressing them in the prompt jumped to the first or last message instead of moving within the text being edited. Corrected Home and End keys to work the normal defacto habit, like it works in normal text editor softwares everywhere else in the world.
Session jump behavior is still available on Ctrl+G and Ctrl+Home for the first message, and on Ctrl+Alt+G and Ctrl+End for the last message. I also updated the TUI hint text so it matches the correct normal behaviour.
How did you verify your code works?
I tested the local TUI in Fedora KDE Konsole with
bun run devand confirmed that Home and End move the prompt caret normally, while Ctrl+Home and Ctrl+End still jump through the conversation. I also checked the browser client in Chrome, and I ran bun typecheck in packages/opencode.Screenshots / recordings
None.
Checklist