fix(tui): remove backslash input buffering #1037
Open
+61
−43
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.
Problem
Previously, pressing
\would buffer the character and wait for the next key press. If followed by Enter, it would insert a newline, Shift+Enter equivalent. If followed by any other key, both characters would be inserted. This caused a noticeable input delay when typing backslashes.Cause
The feature was added in commit 178a3a5 "fix(tui): handle split Shift+Enter in VS Code".
I believe the purpose was supporting an old Claude Code VS Code keybinding. The
/terminal-setupcommand used to add:{ "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\\\r\n" } }This sent a literal backslash + CR + LF when pressing Shift+Enter. The buffering detected this pattern and converted it to a newline. Newer Claude Code versions changed this to
"\u001b\r"Alt+Enter, and Pi's docs now recommend the Kitty sequence"\u001b[13;2u".Solution
I decided to keep this behavior because I believe a few people have developed muscle memory for the
\+Entercombination. Instead of buffering, let\be inserted immediately. On Enter, check if the character before the cursor is\. If so, delete it and insert a newline instead of submitting.I removed the backslash handling entirely from the Input component. These are single-line inputs (search boxes, rename fields); there's no need to insert new lines there.
Screen.Recording.2026-01-28.at.16.33.08.mp4