Skip to content

fix: preserve unframed multiline terminal paste chunks - #268

Merged
hetaoBackend merged 1 commit into
mainfrom
fix/tui-multiline-paste
Sep 21, 2026
Merged

hetaoBackend merged 1 commit into
mainfrom
fix/tui-multiline-paste

Conversation

@hetaoBackend

@hetaoBackend hetaoBackend commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Change

Related to #265. When a terminal delivers an unframed multiline text chunk, StdinBuffer splits its CR bytes into Enter key events. Replaying three CR/CRLF-separated lines through ProcessTerminal and the product Editor reproduced three unintended submissions before this change.

Route plain-text chunks containing an internal line ending through the existing paste event before key splitting. The editor then normalizes line endings and tabs and preserves large-paste folding. Bracketed paste, standalone Enter, text followed only by a final Enter, and control sequences keep their existing paths. No timing heuristic or third-party source change is introduced.

This is a bounded fallback: unframed input split into line-sized or character-sized chunks remains indistinguishable from typing. Conversely, multiple typed lines coalesced into one chunk are treated as a paste. The issue does not identify the host terminal or include raw input bytes, so the reporter's exact WSL cause remains unconfirmed. The issue should remain open for host-terminal confirmation.

Validation

  • PASS: pnpm verify, full profile on clean commit cd9fbe785cab6d033d70615eb6d8fbcf253e0f46, macOS arm64 / Node 26.4.0 (14 applicable gates).
  • PASS: focused editor/input/shortcut regression suite (127 tests), plus the completed new terminal paste suite (9 tests). The CR and CRLF regressions failed before the fix with three separate submissions.
  • PASS: built dist/cli.js in macOS PTYs, regular and fullscreen modes: unframed CRLF multiline draft, fragmented bracketed paste, /help submitted with ordinary Enter, and paste-mode enable/disable output. xterm-headless readback verified draft lines and the resulting Help panel. Synthetic temporary data; network blocked.
  • Performance: basic, covered by the automatic PR benchmark; this change is not a performance optimization or model-streaming change.
  • NOT RUN: real WSL Ubuntu 24 / Shift+Insert clipboard acceptance, native Windows, Linux terminal acceptance, and live providers. PTY byte injection is not a physical clipboard test. Remote CI status is reported separately.

Publication and contribution checks

  • Existing licenses and provenance notices are preserved; no imported code or license changes.
  • No credentials, account data, real user content, internal source history or private review material is included.
  • The new regression file was reviewed, declared in test/vitest-suites.json, and included in regenerated release/public-source.json.
  • Engine local-change records document the behavior and ambiguity boundary. No shared English/Chinese user documentation changed.

Maintainer handoff

Publication scope or license changes: none.

Shared-source port: pending.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@hetaoBackend
hetaoBackend merged commit 3c5d18f into main Sep 21, 2026
13 checks passed
@hetaoBackend
hetaoBackend deleted the fix/tui-multiline-paste branch September 21, 2026 02:46
@hetaoBackend hetaoBackend mentioned this pull request Sep 21, 2026
2 tasks done
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