fix(tui): preserve submit keys across paste release events - #182
Open
BunsDev wants to merge 7 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the TUI’s paste-burst detection in App to correctly preserve and replay submission/navigation keys when terminals emit extended (Kitty-style) key events, and adds regressions to lock in the expected behavior around Enter Press/Release ordering.
Changes:
- Replace single
pending_keylookahead storage with a FIFOpending_keysqueue to preserve ordering of replayed keys. - Extract paste classification into deterministic logic (
classify_paste_burst_events/is_paste_text_key) that ignores Release/Repeat events and retains non-text keys for replay. - Add unit tests covering Kitty-style Enter Release handling, multiline paste behavior, and ordered replay of non-text keys.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src-rust/crates/tui/src/app.rs | Reworks paste-burst classification and key replay to avoid swallowing submit/navigation keys under extended key event protocols; adds focused tests. |
| scripts/fix-generated-newline-literal.py | Adds a one-off script intended to repair a malformed Rust newline literal via blob-guarded replacement. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Complete the unresolved correctness edge from #179 for terminals using extended/Kitty keyboard events.
try_detect_paste_burstpreviously decided whether Enter was an interior newline by callingpoll()blindly. A queuedKeyEventKind::Releasemade a final Enter look as though text followed it, so the submit key could still be absorbed into the paste buffer.This change:
Behavioral contract
text + Enter Press + Enter Releasereplays Enter so the line submits.line 1 + Enter Press + Enter Release + line 2 + final Enterpreserves the interior newline and replays only the final Enter.text + final Enter + Arrowreplays Enter before Arrow.Scope
The final branch diff changes only
src-rust/crates/tui/src/app.rs. The one-shot branch transformation used an exact Git blob assertion and retired itself before this PR was opened.Validation
git diff --check;Historical follow-up to the unresolved review thread on #179.