Repository navigation
fix(tui): a paste split across input batches becomes one chip - #404
Merged
Merged
Conversation
The Windows console delivers an unbracketed paste as keys, and the batch reader cuts that flood at a 12 ms gap or its 400 ms cap. Each batch was folded on its own, so a long paste came out as a chip followed by plain text (or plain text followed by a chip). Track the prompt span the flood has written. Inserts that continue it extend the run; once part of it was a folded paste and the full text is chip-sized, the whole run is replaced with one chip. Live Windows console only; a human pause ends the run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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.
Problem
On Windows, pasting a two-line error (~200 chars) into the prompt collapsed only the first part into
[pasted #N ~ L lines]; the rest was typed out after the chip.The console delivers an unbracketed paste as keys.
read_event_batchends a batch at a 12 ms gap or its 400 ms linger cap, andcoalesce_unbracketed_pastefolds each batch on its own: the first batch became a chip, the short tail was under the chip size and was typed. The reverse split (typed head, chip tail) also happened.Fix
input::PasteRuntracks the prompt span one flood has written. Each insert that continues it (same batch, or inside the flood window, at the run's end) extends the run. Once any part of it was a folded paste and the expanded text is chip-sized, the whole run is replaced with one chip.paste_enter_guard), like the existing flood guards.Tests
split_paste_chip_then_typed_tail_becomes_one_chip(the reported text)split_paste_typed_head_then_chip_becomes_one_chipsplit_paste_in_many_batches_keeps_text_around_ittyping_after_a_paste_is_not_pulled_into_its_chip,a_short_flood_with_a_folded_part_stays_plain_text,a_paste_run_whose_span_went_stale_is_droppedThe first three fail without the fix.
cargo test -p whycodes-tui(1491 passed), clippy, fmt and the budget scripts are clean.🤖 Generated with Claude Code