Skip to content

[Bug]: legacy terminal mouse reports corrupt coordinate bytes #37222

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open the web client's terminal on Linux, wide enough to click column 100.
  2. Run a raw-mode PTY program that enables normal mouse tracking (ESC[?1000h) without UTF-8 or SGR extensions and reads stdin bytes.
  3. Click column 100. Compare with a click near the left edge, then repeat after enabling SGR (ESC[?1006h).

The terminal hunt's reproduction report contains the trusted canvas-input observations and expected/actual packets. An existing public Ghostty core test also reproduces the byte loss.

Expected behavior

Legacy mouse reports preserve their coordinate bytes through terminal input to the PTY. For example, column 96 at row 4 produces press packet 1b5b4d208024.

Actual behavior

The same packet arrives as 1b5b4d20efbfbd24. The mouse encoder's arbitrary coordinate byte was decoded as UTF-8 and replaced by U+FFFD before RPC. Distinct legacy coordinates collapse to the same replacement character, so applications consuming these packets can misparse clicks or receive the wrong cell. ASCII-position, SGR and mode-off controls pass.

Impact

Minor bug or occasional failure

Version or commit

Reproduced on current upstream main 304cf149c8cb5e2c1ab921428773361752d7aff2. Independently confirmed by Claude Opus 5.5 during the Terminal Improvement Bug Hunt on cb251b9abc1403aa02e21e400d0b7f396a195e3c.

Environment

Linux web client in Chromium, actual T3 RPC/server and Linux PTY. No desktop, mobile, Windows, relay or tunnel claim.

Logs or stack traces

At SGR-matched columns 96, 99 and 128 the expected coordinate bytes 80, 83 and a0 all become efbfbd in legacy mode. SGR and low-coordinate controls pass.

Screenshots, recordings, or supporting files

Hunt report

Workaround

Use SGR mouse encoding when the terminal application supports it.

Activity

  1. added
    vouch:trusted
    on Nov 15, 2026
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

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions