Repository navigation
native: fix 16-color drawing and lost mouse clicks in ConEmu - #2200
Merged
Merged
Conversation
ConEmu sends every mouse release in SGR form with X10's button code 3: ESC[<0;37;8M, then ESC[<3;37;8m. The parser read code 3 as no button and dropped the release, so a press never ended. Clicks on tabs and palette entries did nothing, while the wheel worked. The legacy TypeScript parser, the default until #1981, reported these as releases. Such a release now releases the lowest button held, which for a left click is the left button, as the TypeScript parser reported. With no button held it is still not an event. The added line is the comment that names ConEmu. Refs anomalyco/opencode#65894
ConEmu reads an OSC through its ST in one go, but an APC or DCS is not a sequence it knows: when a write ends with the APC's or DCS's ST, ConEmu holds those last two bytes back and parses them again in front of the next write. That second parse loses two more bytes of the next write, after its first sequence. Since #2056 the startup query batch ends with the Kitty graphics query, an APC, and the next write is setup's ESC[s ESC[?1049h. ConEmu runs ESC[s, loses the ESC [, and prints ?1049h as text. It never enters its alternate buffer, the only place it draws 24-bit color, so apps in ConEmu draw with its 16-color palette. The batch now ends with its hide-cursor sequence, which gets no reply and which ConEmu parses whole. Two lines are added: the write on a line of its own, and the comment that says why it is last. Refs anomalyco/opencode#65832
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 theESC [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