fix(tui): bind home/end to line start/end in input#25355
Open
euxaristia wants to merge 2 commits intoanomalyco:devfrom
Open
fix(tui): bind home/end to line start/end in input#25355euxaristia wants to merge 2 commits intoanomalyco:devfrom
euxaristia wants to merge 2 commits intoanomalyco:devfrom
Conversation
Previously home/end (sent by fn+left/right on Apple keyboards and the Home/End keys on PC layouts) were claimed by both messages_first/last and input_buffer_home/end, so pressing them in the input jumped through the message history instead of the current line. Move home/end onto input_line_home/end (the standard convention in terminals and editors) and shift the buffer-jump bindings to ctrl+home/ctrl+end (and ctrl+shift+home/end for selection). Drop the home/end aliases from the message-navigation bindings; ctrl+g and ctrl+alt+g still work for those.
Contributor
|
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. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Found a potential duplicate: PR #19135: "fix(opencode): restore Home/End prompt navigation in TUI"
Both PRs seem to be addressing keybinding behavior for Home/End keys in the terminal UI. Check if #19135 is already merged or if it overlaps with your changes. |
The two tips referencing Home/End for conversation navigation are no longer accurate now that those aliases were removed from messages_first and messages_last in the previous commit.
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #14899
(Overlaps with the older PR #19135, which targets
packages/opencode/src/config/config.ts— keybind defaults have since moved topackages/opencode/src/config/keybinds.ts, so #19135 no longer applies cleanly. This PR updates the current source-of-truth file plus all 18 docs and the in-app tips view; happy to defer to #19135 if its author rebases.)Type of change
What does this PR do?
In the default keybinds,
homeandend(sent by the dedicated Home/End keys on PC layouts and by fn+left / fn+right on Apple keyboards) were claimed by two actions at once:messages_first: "ctrl+g,home"/messages_last: "ctrl+alt+g,end"— message-history navigation.input_buffer_home: "home"/input_buffer_end: "end"— jump to start/end of the entire input buffer.So pressing them in the input did anything except what every other terminal app does — jump to the start/end of the current line. (Issue #14899 reports exactly this: "Nothing happens (it tries to scroll the message history…)".)
The fix moves bindings to match the universal convention used by GNU readline, every major terminal app, and every text editor:
messages_firstctrl+g,homectrl+gmessages_lastctrl+alt+g,endctrl+alt+ginput_line_homectrl+actrl+a,homeinput_line_endctrl+ectrl+e,endinput_select_line_homectrl+shift+actrl+shift+a,shift+homeinput_select_line_endctrl+shift+ectrl+shift+e,shift+endinput_buffer_homehomectrl+homeinput_buffer_endendctrl+endinput_select_buffer_homeshift+homectrl+shift+homeinput_select_buffer_endshift+endctrl+shift+endWhy these new buffer-jump bindings work:
ctrl+home/ctrl+endis the long-standing buffer-jump convention in essentially every text editor (VS Code, JetBrains, Sublime). Users who already customized any of these in theirtui.jsonkeep their override — defaults are only applied when a key is absent.Other touched files:
keybinds.mdxfiles (English + 17 locales) updated so the published default table matcheskeybinds.ts.tips-view.tsx— two tips that said "Press Ctrl+G or Home" / "Press Ctrl+Alt+G or End" updated to drop the now-removed alias.How did you verify your code works?
bun turbo typecheckfrom the repo root — all 13 packages pass.fn+left/fn+right(which the terminal sends as Home/End) now move the caret to line start/end inside a multi-line prompt instead of scrolling the conversation.ctrl+home/ctrl+endjump to the start/end of the entire input buffer.shift+home/shift+endextend selection to line start/end;ctrl+shift+home/ctrl+shift+endextend to buffer start/end.ctrl+g/ctrl+alt+gstill navigate message-history first/last.Screenshots / recordings
Not applicable — no visual changes; the only user-visible text change is the two tip strings, which are covered in the diff.
Checklist