-
Notifications
You must be signed in to change notification settings - Fork 6.2k
fix(tui/win): keep paste mode across multi-read bursts; adaptive guar… #5585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cpjet64
wants to merge
14
commits into
openai:main
Choose a base branch
from
cpjet64:fix/win-tui-bracketed-paste
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+119
−22
Conversation
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
…d; submit grace - Track last_paste_at to keep paste active across large multi-read bursts - Adaptive idle window: +160ms for >=1KB, +320ms for >=2KB chunks (base from CODEX_PASTE_GUARD_MS, default 180ms) - Widen submit grace to 16ms; gate Enter while within deadline or recent paste window - Treat bracketed paste as explicit paste; small-paste behavior unchanged - Input-only: CRLF normalization remains in TUI paste path; no file I/O changes Refs openai#5499 openai#2137; partial openai#5194
|
迫切需要修复这个问题! |
|
没有人来审批吗? 迫切需要修复这个问题,现在windows的终端模式基本无法使用! |
|
Thanks for the contribution, and apologies for the slow response. We have a large backlog of PRs that we're getting through. If you're still interested in pursuing this PR, could you please fix the CI failures? Looks like a formatting issue, so it should be easy to address. |
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.
Harden Windows TUI paste-burst handling
Problem & intent
Large multi-read pastes on Windows could drop out of “pasting” mid-stream and submit early (often around line 6/12 on long inputs). This PR hardens the TUI input handler so pastes are treated as one cohesive input, without changing any platform env behavior (PATH/PATHEXT/etc. are already addressed by #5579).
Before / After
Before
The heuristic paste guard could expire between
read()chunks; the next Enter/\rwas treated as Submit instead of a newline.After
is_pastingtrue acrossread()chunks.\n, no submit) until the paste ends or the window elapses.Scope of change
codex-rs/tui/src/bottom_pane/paste_burst.rslast_paste_attimestamp to persist paste state across multi‑read bursts.CODEX_PASTE_GUARD_MS, default 180 ms), +160 ms for ≥ 1 KiB, +320 ms for ≥ 2 KiB.last_paste_at.mark_explicit_paste(size, now)and call it on explicit paste events.codex-rs/tui/src/bottom_pane/chat_composer.rsmark_explicit_paste(...)from the paste handler.Security effects
None. This only changes how input bytes are interpreted in the TUI. No policy, sandbox, or privilege changes.
Testing evidence
Static
cargo fmtcargo clippy -p codex-tui -- -D warnings→ cleancargo test -p codex-tui→ passing (424 tests)Manual verification (Windows Terminal, PowerShell 5/7)
A) Variant 1
B) Variant 2
C) Variant 3
D) Variant 4
E) Variant 5
Configuration
CODEX_PASTE_GUARD_MS(default 180 ms).Checklist
cargo fmtandclippycleancodex-tui