Skip to content

fix(tui): preserve IME text before return submit - #39695

Closed
InphinitiZ wants to merge 1 commit into
NousResearch:mainfrom
InphinitiZ:fix/tui-ime-return-burst
Closed

fix(tui): preserve IME text before return submit#39695
InphinitiZ wants to merge 1 commit into
NousResearch:mainfrom
InphinitiZ:fix/tui-ime-return-burst

Conversation

@InphinitiZ

@InphinitiZ InphinitiZ commented Jun 5, 2026

Copy link
Copy Markdown

Summary

  • Preserve printable IME commit text when xterm delivers it in the same input burst as Return.
  • Submit the pending value from the Return keypath so Dashboard/TUI sends the visible draft instead of dropping the final segment.
  • Add focused regression coverage for Return-burst inputs and fix the execFileNoThrow stdio tuple typing that blocked ui-tui type-check.

Why

A browser/xterm IME flow can deliver finalized CJK text immediately followed by Return in one input burst, e.g. 会丢失内容\r. The previous Return branch submitted vRef.current before the printable prefix had gone through the ordinary input path, so the prompt visible in the UI could be longer than the submitted prompt.

This is adjacent to #39246, but covers the "IME commit text + Return in the same burst should submit the visible draft" path rather than absorbing Enter as an IME-confirmation guard. Desktop IME syncing is left to #39435.

Scope

This targets the ui-tui text input path used by the Dashboard chat's embedded TUI/xterm session. It does not touch the Electron Desktop composer (apps/desktop/...); the separate Desktop IME sync issue is covered by #39435.

Test Plan

  • git diff --cached --check
  • Static scan of added lines for hardcoded secrets / shell injection / eval / pickle / SQL injection patterns
  • npm run test --workspace ui-tui -- src/__tests__/textInputReturnBurst.test.ts
  • npm run type-check --workspace ui-tui
  • npm run build --workspace ui-tui
  • Independent reviewer pass: no security concerns or logic errors

Preserve printable IME commit text when xterm delivers it in the same input burst as Return, so Dashboard/TUI submits the visible draft instead of dropping the final segment.

Also fixes the TUI type-check stdio tuple typing and adds focused regression coverage.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jun 5, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused TUI fix. The current shared Return path still submits vRef.current without incorporating inp (ui-tui/src/components/textInput.tsx:990-999), so the reported combined IME-text-plus-Return burst remains actionable. The proposed helper reuses applyPrintableInsert, including selection handling, and applies the pending value consistently to both submit and newline paths.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
@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-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants