Skip to content

fix(tui): preserve submit keys across paste release events - #182

Open
BunsDev wants to merge 7 commits into
mainfrom
fix/paste-burst-release-events
Open

fix(tui): preserve submit keys across paste release events#182
BunsDev wants to merge 7 commits into
mainfrom
fix/paste-burst-release-events

Conversation

@BunsDev

@BunsDev BunsDev commented Aug 23, 2026

Copy link
Copy Markdown
Member

Summary

Complete the unresolved correctness edge from #179 for terminals using extended/Kitty keyboard events.

try_detect_paste_burst previously decided whether Enter was an interior newline by calling poll() blindly. A queued KeyEventKind::Release made a final Enter look as though text followed it, so the submit key could still be absorbed into the paste buffer.

This change:

  • ignores Release/Repeat events while classifying a paste, matching both interactive loops' existing Press-only contract;
  • distinguishes subsequent text presses from navigation/modifier presses;
  • retains every meaningful lookahead key in a FIFO rather than dropping either final Enter or the key behind it;
  • extracts deterministic classification logic from the global crossterm queue;
  • adds focused regressions for Kitty-style Enter releases, multiline pastes, final submission, and ordered non-text replay.

Behavioral contract

  • text + Enter Press + Enter Release replays Enter so the line submits.
  • line 1 + Enter Press + Enter Release + line 2 + final Enter preserves the interior newline and replays only the final Enter.
  • text + final Enter + Arrow replays Enter before Arrow.
  • Release/Repeat events never count as evidence that more paste text follows.

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

  • generated diff passed git diff --check;
  • four deterministic unit regressions are included;
  • required Rust/TUI CI is expected to provide compile, formatting, and integration coverage before merge.

Historical follow-up to the unresolved review thread on #179.

Copilot AI lite review requested due to automatic review settings August 23, 2026 00:11
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 23, 2026 12:16am

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_key lookahead storage with a FIFO pending_keys queue 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.

Comment thread src-rust/crates/tui/src/app.rs Outdated
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.

2 participants