8000 fix(tui): remove backslash input buffering by Perlence · Pull Request #1037 · badlogic/pi-mono · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@Perlence
Copy link
Contributor
@Perlence Perlence commented Jan 28, 2026

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-setup command 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 \+Enter combination. 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

Instead of buffering `\` and waiting for the next key, let it be
inserted immediately. On Enter, check if preceded by `\` and treat as
newline.

Removed backslash handling from the Input component entirely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0