Skip to content

fix(tui): clear input after Korean IME submit - #38245

Closed
sweetcornna wants to merge 1 commit into
NousResearch:mainfrom
sweetcornna:codex/fix-38117-korean-ime-input
Closed

fix(tui): clear input after Korean IME submit#38245
sweetcornna wants to merge 1 commit into
NousResearch:mainfrom
sweetcornna:codex/fix-38117-korean-ime-input

Conversation

@sweetcornna

Copy link
Copy Markdown
Contributor

Summary

  • distinguish a TextInput self-echo from an external controlled-value update
  • allow the parent value="" update after submit to clear the internal buffer
  • add a regression test for Korean IME text submitted immediately after the final syllable commit

Root cause

TextInput used self.current to ignore the next controlled value update after internal edits. When a Korean IME final syllable and Enter arrived together, the parent cleared the value after submit, but the component still treated that clear as its own echo and kept the final syllable in the internal buffer.

Closes #38117.

Verification

  • npm test -- --run src/__tests__/textInputSubmitClear.test.tsx src/__tests__/textInputFastEcho.test.ts src/__tests__/textInputCursorSourceOfTruth.test.ts src/lib/editor.test.ts in ui-tui (41 passed)
  • npx eslint src/components/textInput.tsx src/__tests__/textInputSubmitClear.test.tsx in ui-tui (exit 0; existing react-compiler warning at textInput.tsx:898)
  • git diff --check origin/main..HEAD

@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have labels Jun 3, 2026
@sweetcornna
sweetcornna marked this pull request as ready for review June 3, 2026 15:37
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression fix. Current main still has the unconditional self-echo suppression at ui-tui/src/components/textInput.tsx:568-581, so a parent value="" update can be ignored whenever self.current remains set. The proposed equality check in PR commit 4df1b98e2afe distinguishes that external clear from the actual local echo, and the added Ink test exercises the final-Korean-syllable-plus-Enter sequence.

The PR branch is behind current main, but the current-main diff from its merge base does not touch this effect hunk; this should be a mechanical salvage.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
iykwak10-sys added a commit to iykwak10-sys/hermes-agent that referenced this pull request Aug 5, 2026
Cherry-pick of PR NousResearch#38245 by sweetcornna.
Distinguish a TextInput self-echo from an external controlled-value
update so the parent value="" clear after submit actually clears
the internal buffer instead of being ignored as a self-echo.

Fixes: Korean IME final syllable stuck in input after submit.
Closes NousResearch#38117.
iykwak10-sys added a commit to iykwak10-sys/hermes-agent that referenced this pull request Aug 5, 2026
When React batches onChange+onSubmit, setValue('') can arrive while
self.current is still true. Since IME never produces empty strings,
treat value==='' as always external — never a self-echo.

Ref: PR NousResearch#38245, Issue NousResearch#38117
iykwak10-sys added a commit to iykwak10-sys/hermes-agent that referenced this pull request Aug 5, 2026
…ast syllable

When Korean IME commits its final composition and Enter in the same
useInput event, the k.return handler fired before the printable-input
path, so vRef.current lacked the last composed syllable. The IME commit
then landed in the cleared input field, leaving a stranded character.

Now the Enter handler checks for pending printable input first and
applies it to vRef.current synchronously, so cbSubmit sees the full
value.

Refs: NousResearch#38117, PR NousResearch#38245
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for this fix! It was salvaged into #86761 (cherry-picked onto current main with your authorship preserved in the commit history) and is now merged. Closing since the work has landed.

@teknium1 teknium1 closed this Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: typing Korean leaves last syllable in input

3 participants