Skip to content

Touch IME bridge: decide behaviour for alternate-screen apps and CJK composition #1887

Open

Description

@waleedkadous

Context

PR #1884 (the fix for issue #1883, mobile autocomplete duplicating text) adds a touch-only IME bridge (apps/web/src/lib/imeInput.ts). On (pointer: coarse) devices it keeps composition and input events away from xterm.js and sends each textarea edit to the PTY live, as DELs plus new text. In a line editor this converges to exactly what the keyboard shows. Two cases where live streaming behaves differently from stock xterm need a decision. Neither has been tried on a real device.

1. Alternate-screen apps (vim normal mode, less, fzf, TUI menus)

There, the bytes are commands, not text. Composing text streams letter by letter, and when the keyboard revises it (autocomplete, autocorrect), the bridge sends DELs and the new text. In vim normal mode a DEL moves the cursor left and each letter is a command. Stock xterm was also wrong here: it resent the whole textarea on such edits, which is the #1883 bug itself. So this is not a regression, but it is a different wrong.

Option: bypass the bridge while term.buffer.active.type === 'alternate', and let xterm's own handlers run. That brings back stock behaviour, including its resend bug, for full-screen apps.

2. CJK input on touch devices

xterm's composition overlay never activates on touch, because the bridge shields composition events. Intermediate composing text (kana) streams to the PTY as it is typed, then is retracted with DELs and replaced when the IME converts it (kanji). The bytes converge in a line editor. But the user sees the kana appear on the line before conversion, the shell sees every intermediate edit, and stock xterm sent only the committed text at compositionend.

Options: buffer while a composition is active and send at compositionend (the issue's original prescription; it means typing blind for Latin keyboards, which compose every word), or do that only for non-Latin IMEs.

To decide

Try both on a phone (Android Gboard and iOS, with a Japanese or Chinese keyboard for case 2; vim for case 1). Then choose per case: keep, bypass, or buffer.

Raised by the PR review of PR #1884 (codex and claude).

Activity

  1. added
    area/terminal
    on Nov 9, 2026
  2. added a commit that references this issue on Nov 9, 2026
  3. waleedkadous commented on Nov 10, 2026

    @waleedkadous
    ContributorAuthor

    Status 2026-11-10: the bridge is confirmed on a real Android Chrome device by the owner (see #1883). iOS Safari is still unverified on real hardware, in addition to the alternate-screen and CJK questions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/terminal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions