Preserve multiline pastes without bracketed paste markers (#63785)

## Why

When a terminal sends pasted text as individual keystrokes, the TUI can
mistake a pasted newline for a submit key. This can happen after a short
Unicode prefix or after a redraw has already displayed a pasted line.

## What changed

Keep the paste detection window open after buffered text becomes visible.
Treat plain Enter within that window as a pasted newline and buffer any
following indentation with it. A single IME character still allows Enter
to submit in the regular composer.

Apply the same paste timing to startup drafts so Enter can confirm the
draft once the paste window expires. Keep newline-and-tab-only pastes
literal inside blockquotes.

## Testing

Cover multiline pastes with Unicode prefixes, tabs after pasted newlines,
and Enter handling before and after the paste window expires.

GitOrigin-RevId: e8f63dfead0cc97d44001000e961a6f6d05d4900
This commit is contained in:
Eric Traut
2026-11-25 00:57:54 +00:00
committed by copyberry
parent a6fadff7a2
commit c7f0d3da0c
13 changed files with 159 additions and 155 deletions
+3 -1
View File
@@ -116,7 +116,9 @@ async fn picker_side_worktree_fork_and_cd_run_on_the_production_stack() -> Resul
// A trailing bare Escape must not consume the first character of the fresh edit.
terminal.write_input(b"\x1b[27u\x1b[27u\r\x1b[27u\x1b[27u\r\x1b")?;
terminal.wait_for_screen("Conversation reverted to this point")?;
terminal.write_input(b" Revised.")?;
// Leave the leading space unmarked to exercise Escape, then explicitly
// end the paste so the next Enter is an unambiguous submit.
terminal.write_input(b" \x1b[200~Revised.\x1b[201~")?;
terminal.wait_for_screen("Reply with the marker requested by this test. Revised.")?;
let _edited_reply = responses::mount_sse_once_match(
&server,