Skip to content

Conversation

@genki
Copy link
Contributor

@genki genki commented Sep 27, 2025

Summary

  • ensure paste burst flush preserves ASCII characters before IME commits
  • add regression test covering digit followed by Japanese text submission

Fixes #4356

Testing

  • just fmt
  • just fix -p codex-tui
  • cargo test -p codex-tui

@github-actions
Copy link

github-actions bot commented Sep 27, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@genki
Copy link
Contributor Author

genki commented Sep 27, 2025

I have read the CLA Document and I hereby sign the CLA

@joshka-oai
Copy link
Collaborator

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ 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
  • 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 address that feedback".

@joshka-oai joshka-oai force-pushed the fix/ime-leading-digit branch from abb5595 to 593336d Compare October 21, 2025 01:18
Copy link
Collaborator

@joshka-oai joshka-oai left a comment

Choose a reason for hiding this comment

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

I made a couple of small tweaks on this based on reading through the interaction between the chat composer and the paste_burst code. I kept the self.active = true and removed the call to clear_after_explicit_paste(). I intentionally let an empty string be handled as Some("") instead of None.

The calling code in chat composer calls the flush_before_modified() and then immediately calls the handle_paste() which calls clear_after_explicit_paste(). These are temporally coupled in a bit of a weird way. This logic could be improved to remove the temporal coupling, but for now I'd prefer to leave that there and not have code that calls this public method internally as it makes it more difficult to reason about the state machine and this makes the interactions temporally and directly coupled.

The Some("") path gets treated as a noop paste, which is fine - it shouldn't cause problems as inserting a blank string does nothing, and resetting the other parts of state is seems cheap.

The self.active is probably unnecessary as the later call from chat_composer to clear_after... will set this to false, but I left it there mostly to keep this as-is and only change the problematic part.


Can you please pull this updated copy down and take a quick look. I think it should still work as it did previous, but testing on real language specific keyboards can sometimes highlight other problems. I'm only able to test using the Romanji keyboard settings, so I'm not sure that I'm reproducing your issue 100% accurately.

Once you've tested the changes I made, I'll go ahead and merge this.


Side note:

Ideally this struct probably should be refactored a bit to an enum something like:

enum PasteBurst {
    Inactive,
    Active { last_plain_char_time, ... }
}

Or possibly a few more states that have to do with how many keys are held / buffered to make it a bit more clear how the state machine works. But that's an exercise for another time.

I also slapped a quick rebase on main to bring this up to date.

@genki
Copy link
Contributor Author

genki commented Oct 22, 2025

@joshka-oai

Thank you for update!
I have confirmed this PR with the latest main branch keeps correctly fix this issue at my environment :)

@genki genki requested a review from joshka-oai October 22, 2025 16:48
@joshka-oai joshka-oai enabled auto-merge (squash) October 22, 2025 22:04
Copy link
Collaborator

@joshka-oai joshka-oai left a comment

Choose a reason for hiding this comment

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

Thanks for the PR

@joshka-oai joshka-oai merged commit ed32da0 into openai:main Oct 22, 2025
20 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 22, 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.

Leading half-width numerals in Japanese input are dropped from the prompt (e.g., “1人”)

2 participants