Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

this is the nightmail #osc

14,763 Aufrufe • vor 4 Monaten •via X (Twitter)

0 Kommentare

Keine Kommentare verfügbar

Kommentare vom Original-Post werden hier angezeigt

Ähnliche Videos

Got flash banged by OpenCode recently? Yeah, that was me. Here's what happened: OpenCode/OpenTUI detects terminal theme mode (light or dark) by querying OSC 10/11 for the terminal’s foreground/background colors and deriving the mode from those values. OpenTUI also enables DEC Private Mode 2031 to receive theme-change notifications. When that mode is enabled, terminals can send CSI 997 when the system theme changes. OpenTUI treated the 997 payload as authoritative and let it override the OSC 10/11-derived result. That turned out to be wrong. In some terminals, the 997 payload is simply unreliable: it can report light while the queried terminal colors clearly indicate a dark theme. That’s what caused the flash bangs. The fix seemed straightforward: stop trusting the 997 payload as the actual theme mode and use it only as a trigger to re-query OSC 10/11, then derive the mode from the returned foreground/background colors. That works great. Except OpenTUI had also started using OSC 11 to set the terminal’s default background color, so the terminal gutter around the drawn TUI matched the app background instead of the terminal’s own default background. This was introduced recently in OpenTUI. That created a new problem: if you use OSC 11 to override the terminal background, then later query OSC 11, you are just reading back your own override instead of the terminal’s real theme background. No problem. Reset the terminal background with OSC 111, query OSC 10/11, derive the mode, then restore the renderer background again. Oh wait. Turns out Ghostty has a bug. Once this background reset/override path is used, later OSC 11 background reporting can get stuck and stop tracking system theme changes correctly. Even though theme-change notifications still fire and OSC 10 foreground updates continue. This would cause further issues where the OSC 10/11 derivation would be wrong again. So for now: no using OSC 11 to set the terminal background color just to fill the gutter. TL;DR: OpenTUI must treat CSI 997 only as a hint that the terminal theme may have changed and rely exclusively on OSC 10/11 color queries for actual theme mode detection, while avoiding terminal background mutation via OSC 11/111 because that breaks correctness in some terminals like Ghostty.

kmdr

29,509 Aufrufe • vor 1 Monat