Repository navigation
Conversation
ctrl+u (input_delete_to_line_start) deletes from the cursor back to the start of its line, as bash and readline's unix-line-discard do. zsh users expect it to delete the whole line wherever the cursor is (kill-whole-line). input.line_discard in tui.json chooses: 'bash' (default, unchanged behaviour) or 'zsh'. "Line" is the cursor's logical line in both modes, never the rest of a multi-line prompt. 'zsh' moves the cursor to the line's end and runs opentui's deleteToLineStart, so both modes keep its edge behaviour (a press at the start of a line, or on an empty one, joins it to the line above) and input_undo restores the text. The setting applies to every text field: registerOpencodeKeymap replaces the managed textarea's input.delete.to.line.start command (packages/tui/src/keymap.tsx) and adds a binding layer for focused single-line <input> fields, which otherwise handle ctrl+u natively. That covers the prompt, permission and question replies, dialog prompts, the export options editor, select-dialog filters and the run-mode footer, which receives the setting through RunTuiConfig.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
This branch has not been deployed
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.
Note: I'm aware v1 is now the maintenance branch and new features go to v2 only. This PR is here for others to use, and I'll submit the v2 version once I've migrated my whole plugin system to it.
Issue for this PR
Closes #56242
Type of change
What does this PR do?
ctrl+u (
input_delete_to_line_start) deletes from the cursor back to the start of its line, as bash does. zsh users expect it to delete the whole line wherever the cursor is.input.line_discardin tui.json:"bash"(default, today's behavior) or"zsh"."zsh"moves the cursor to the end of the line and runs opentui'sdeleteToLineStart, so both modes keep its edge behavior: a press at the start of a line, or on an empty one, joins it to the line above.input_undorestores the text.registerOpencodeKeymapreplaces the textarea'sinput.delete.to.line.startcommand and adds a binding layer for a focused single-line<input>, which otherwise handles ctrl+u itself. That covers the prompt, question and permission replies, dialog prompts, the export options editor, select-dialog filters and therunfooter, which gets the setting throughRunTuiConfig.How did you verify your code works?
bun typecheckin packages/tui and packages/opencode.test/keymap.test.tsxsends a real\x15through the keymap:hello worldwith the cursor afterhellobecomesworld(unset and"bash") and empty ("zsh"), in a textarea and in an<input>; infirst / hello world / lastonly the middle line changes; undo brings each back.hello worldwith the cursor afterhelloin the prompt and in the command palette filter givesworld("bash"and unset) and an empty field ("zsh"); in a three-line prompt only the middle line changes, and ctrl+z brings it back.Screenshots / recordings
Behavior-only change, no visual change.
Checklist
This PR is AI generated, but under direct supervision and on request of @Nowaker.