[PR #18767] Add support for OSC 104, 110, 111, 112 and 117 (resets) #31600

Open
opened 2026-01-31 09:48:18 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/18767

State: closed
Merged: Yes


This pull request adds support for resetting the various color table entries and xterm resource values back to their defaults.

Building on the default color table James introduced in #17879, it was relatively straightforward to add support for resetting specific entries.

This implementation cleaves tightly to observed behavior in xterm(379) rather than observed behavior in libvte(0.70.6). They differ in the following ways:

  • xterm rejects any OSC [110..119] with any number of parameters; libvte accepts it but only resets the first color.
  • When passed a list of color indices to reset in 104, xterm resets any colors up until the first one which fails to parse as an integer and does not reset the rest; libvte resets all parseable color indices.

I was unable to verify how these reset commands interact with colors set via DECAC Assign Color so I went with the implementation that made the most sense:

  • Resetting the background color with 110 also restores the background color alias entry to its pre-DECAC value; this results in the perceived background color returning to e.g. index 0 in conhost and the background color in Terminal.
  • ibid. for the foreground color

Refs #18695
Refs #17879
Closes #3719

**Original Pull Request:** https://github.com/microsoft/terminal/pull/18767 **State:** closed **Merged:** Yes --- This pull request adds support for resetting the various color table entries and xterm resource values back to their defaults. Building on the default color table James introduced in #17879, it was relatively straightforward to add support for resetting specific entries. This implementation cleaves tightly to observed behavior in xterm(379) rather than observed behavior in libvte(0.70.6). They differ in the following ways: - xterm rejects any OSC [110..119] with any number of parameters; libvte accepts it but only resets the first color. - When passed a list of color indices to reset in 104, xterm resets any colors up until the first one which fails to parse as an integer and does _not_ reset the rest; libvte resets all parseable color indices. I was unable to verify how these reset commands interact with colors set via `DECAC Assign Color` so I went with the implementation that made the most sense: - Resetting the background color with `110` also restores the background color alias entry to its pre-`DECAC` value; this results in the perceived background color returning to e.g. index 0 in conhost and the `background` color in Terminal. - _ibid._ for the foreground color Refs #18695 Refs #17879 Closes #3719
claunia added the pull-request label 2026-01-31 09:48:18 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31600