Skip to content

Conversation

aibrahim-oai
Copy link
Collaborator

@aibrahim-oai aibrahim-oai commented Aug 25, 2025

This PR fixes two edge cases in managing burst paste (mainly on power shell).
Bugs:

  • Needs an event key after paste to render the pasted items

ChatComposer::flush_paste_burst_if_due() flushes on timeout. Called:
- Pre-render in App on TuiEvent::Draw.
- Via a delayed frame
BottomPane::request_redraw_in(ChatComposer::recommended_paste_flush_delay()).

  • Parses two key events separately before starting parsing burst paste

When threshold is crossed, pull preceding burst chars out of the textarea and prepend to paste_burst_buffer, then keep buffering.

@aibrahim-oai aibrahim-oai requested a review from bolinfest August 25, 2025 20:56
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines 162 to 193
if needs_redraw {
self.request_redraw();
}
if self.composer.is_in_paste_burst() {
self.request_redraw_in(
crate::bottom_pane::chat_composer::ChatComposer::recommended_paste_flush_delay(
),
Copy link
Contributor

Choose a reason for hiding this comment

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

[P1] Scheduled redraw may not flush paste burst

Key handling schedules a redraw after each char (bottom_pane/mod.rs:161‑169) expecting flush_paste_burst_if_due (chat_composer.rs:142‑151) to run when enough time passes. But the frame scheduler only keeps the earliest deadline (tui.rs:202‑209), so later keystrokes can’t delay the draw. If the final char arrives shortly before that deadline, no further frame is queued and the buffered paste stays unflushed until another user event.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai removed the request for review from bolinfest August 25, 2025 21:09
@aibrahim-oai aibrahim-oai force-pushed the fix_paste branch 2 times, most recently from 5eccf32 to bb2fc9a Compare August 25, 2025 23:32
@bolinfest
Copy link
Collaborator

Should we have a config option to disable the paste burst logic just in case someone is using a terminal that doesn't play well with this logic so at least they have an escape hatch in this case?

@aibrahim-oai
Copy link
Collaborator Author

@bolinfest that's a good idea. is there a way of knowing we are on windows? we can only enable it by default to windows.

@aibrahim-oai
Copy link
Collaborator Author

there should be a way

Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

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

Some questions and small comments to start.

@bolinfest
Copy link
Collaborator

@bolinfest that's a good idea. is there a way of knowing we are on windows? we can only enable it by default to windows.

I believe @dedrisian-oai said this was also applicable to the VS Code terminal? And using Codex CLI over ssh?

@aibrahim-oai aibrahim-oai requested a review from bolinfest August 26, 2025 03:06
assert_eq!(imgs, vec![tmp_path.clone()]);
}

#[test]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice tests!

@dedrisian-oai
Copy link
Collaborator

Just tested on a windows machine; works well! 👍

@aibrahim-oai aibrahim-oai merged commit c9ca63d into main Aug 28, 2025
15 checks passed
@aibrahim-oai aibrahim-oai deleted the fix_paste branch August 28, 2025 19:54
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants