Skip to content

core: remove the legacy stdin parser - #1981

Merged
simonklee merged 2 commits into
mainfrom
track/remove-legacy-input-parser
Nov 10, 2026
Merged

simonklee merged 2 commits into
mainfrom
track/remove-legacy-input-parser

Conversation

@simonklee

Copy link
Copy Markdown
Member

The renderer parsed stdin with the TypeScript parser unless an app opted into the native one. OpenCode never did, so
it still ran the TypeScript parser. The native parser is now the only one.

Breaking changes: experimental_nativeInput and OTUI_NATIVE_INPUT_PARSER are removed; input always uses the native
parser. stdinParserMaxBufferBytes is removed; the native parser bounds its own buffer. OTUI_NATIVE_INPUT_SHADOW is
removed; to report a parser bug, attach an OTUI_STDIN_LOG capture. StdinParser, StdinParserOptions,
StdinParserProtocolContext, StdinEvent and StdinResponseProtocol are removed with no replacement; use
renderer.keyInput, prependInputHandler or subscribeOsc.

Apps now get native's behavior: Alt with punctuation and non-ASCII keys, modified F3 after startup, and wheel and
held-button mouse reports decode correctly; a terminal reply split by a pause is no longer typed; startup, theme and
palette waits end at the terminal's DA1 reply instead of on timers. Once a terminal confirms the Kitty keyboard
protocol, an Escape that ends a read is the Escape key at once, without the 20 ms wait. A single eight-bit Meta byte
waits as the start of a UTF-8 character.

Tested with the Core suite on Bun and Node and the native, React, Solid, SSH, keymap and Rust suites.

Fixes #1634
Fixes #1635

The TypeScript stdin parser was the default, and the native parser was
opt-in through experimental_nativeInput or OTUI_NATIVE_INPUT_PARSER.
Native is now the only parser. The option, both environment variables,
the OTUI_NATIVE_INPUT_SHADOW comparator, stdinParserMaxBufferBytes and
the StdinParser exports go with the TypeScript parser, 2,077 lines.

Clock mode stays: a session that misses a DA1 reply still switches to
it, so the 5 s backstop and the palette and theme timers remain.

Tests that ran on the legacy parser by default now run on native. Four
expectations follow native's deliberate differences: a UTF-8 lead byte
waits for the rest of its character, motion with a held button is a
drag, and a Kitty key code that is a control character is not a key.

Issue: 044, 196, 197
Fixes #1634
Fixes #1635
With the native parser alone, the renderer's startupCursorCprActive
updates never change the expectations: explicitWidthCprActive spans the
same startup batch. Its kittyKeyboardEnabled writes have no effect,
because the Session sets the Kitty expectation from the terminal on
every feed. The clock-mode arm of suspend() is unreachable, since the
startup batch's backstop always fires first.

Remove them, and fix two docs pages and the conformance header that
still described the five-second window and todo rows. A native row pins
that a C1 Kitty key code is a reply, not a key.
@simonklee
simonklee requested a review from kommander as a code owner November 9, 2026 23:22
@simonklee
simonklee merged commit aea0b25 into main Nov 10, 2026
33 checks passed
@simonklee
simonklee deleted the track/remove-legacy-input-parser branch November 10, 2026 04:03
simonklee added a commit that referenced this pull request Nov 23, 2026
Since 0.9.0, apps in ConEmu draw with its 16-color palette, and mouse
clicks do nothing while the wheel works.

Colors: when a write ends with the ST of an APC or DCS, ConEmu holds it
back, then drops it and two more bytes of the next write. Since #2056
the startup queries end with the Kitty graphics APC, and the next write
is `ESC[s ESC[?1049h`. ConEmu loses the `ESC [` and never enters its
alternate buffer, the only one where it draws 24-bit color. The batch
now ends with its hide-cursor CSI.

Clicks: ConEmu sends every SGR release as button 3. The native parser
dropped those; the TypeScript parser removed in #1981 did not. Such a
release now releases the held button.

Checked on Windows 11 in ConEmu 230724, conhost and Windows Terminal,
with a Core app and OpenCode 2.4.0. Lost clicks in conhost on older
Windows 10 builds are a separate case that this does not fix.

Refs anomalyco/opencode#65832, anomalyco/opencode#65894
Dicklesworthstone pushed a commit to Dicklesworthstone/opentui that referenced this pull request Nov 23, 2026
…co#2200)

Since 0.9.0, apps in ConEmu draw with its 16-color palette, and mouse
clicks do nothing while the wheel works.

Colors: when a write ends with the ST of an APC or DCS, ConEmu holds it
back, then drops it and two more bytes of the next write. Since anomalyco#2056
the startup queries end with the Kitty graphics APC, and the next write
is `ESC[s ESC[?1049h`. ConEmu loses the `ESC [` and never enters its
alternate buffer, the only one where it draws 24-bit color. The batch
now ends with its hide-cursor CSI.

Clicks: ConEmu sends every SGR release as button 3. The native parser
dropped those; the TypeScript parser removed in anomalyco#1981 did not. Such a
release now releases the held button.

Checked on Windows 11 in ConEmu 230724, conhost and Windows Terminal,
with a Core app and OpenCode 2.4.0. Lost clicks in conhost on older
Windows 10 builds are a separate case that this does not fix.

Refs anomalyco/opencode#65832, anomalyco/opencode#65894

(cherry picked from commit 234ae0c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant