[PR #13139] [MERGED] Add support for restoring a DECCTR color table report #29404

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13139
Author: @j4james
Created: 5/22/2022
Status: Merged
Merged: 6/3/2022
Merged by: @undefined

Base: mainHead: feature-decctr


📝 Commits (8)

  • 7da4d8d Add color conversion routines.
  • f88e198 Hook up the DECRSTS sequence to the dispatch class.
  • e7a1b1c Add a handler for restoring the color table.
  • a44a1da Add some unit tests.
  • 8042cf8 Add terms to spelling bot's dictionary.
  • 1c21fe9 Use a lookup table for ColorFromRGB100 conversion.
  • 3577283 Add DECRSTS to spelling bot's dictionary.
  • d778ff2 Use til::at in place of gsl::at.

📊 Changes

11 files changed (+414 additions, -1 deletions)

View changed files

📝 .github/actions/spelling/expect/expect.txt (+4 -0)
📝 src/host/ut_host/ScreenBufferTests.cpp (+232 -0)
📝 src/terminal/adapter/DispatchTypes.hpp (+12 -0)
📝 src/terminal/adapter/ITermDispatch.hpp (+2 -0)
📝 src/terminal/adapter/adaptDispatch.cpp (+73 -0)
📝 src/terminal/adapter/adaptDispatch.hpp (+4 -0)
📝 src/terminal/adapter/termDispatch.hpp (+3 -1)
📝 src/terminal/parser/OutputStateMachineEngine.cpp (+3 -0)
📝 src/terminal/parser/OutputStateMachineEngine.hpp (+1 -0)
📝 src/types/inc/utils.hpp (+2 -0)
📝 src/types/utils.cpp (+78 -0)

📄 Description

This PR introduces the framework for the DECRSTS sequence which is
used to restore terminal state reports. But to start with, I've just
implemented the DECCTR color table report, which provides a way for
applications to alter the terminal's color scheme.

PR Checklist

  • Closes Invalid Title after opening new tab via command line (#13132)
  • CLA signed.
  • Tests added/passed
  • Documentation updated.
  • Schema updated.
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

I've added the functions for parsing DEC RGB and HLS color formats into
the Utils class, where we've got all our other color parsing routines,
since this functionality will eventually be needed in other VT protocols
like Sixel and ReGIS.

Since DECRSTS is a DCS sequence, this only works in conhost for now,
or when using the experimental passthrough mode in Windows Terminal.

Validation Steps Performed

I've added a number of unit tests to check that the DECCTR report is
being interpreted as expected. This includes various edge cases (e.g.
omitted and out-of-range parameters), which I have confirmed to match
the color parsing on a real VT240 terminal.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/13139 **Author:** [@j4james](https://github.com/j4james) **Created:** 5/22/2022 **Status:** ✅ Merged **Merged:** 6/3/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `feature-decctr` --- ### 📝 Commits (8) - [`7da4d8d`](https://github.com/microsoft/terminal/commit/7da4d8d1322bff40792f1592bf79e191a0bff504) Add color conversion routines. - [`f88e198`](https://github.com/microsoft/terminal/commit/f88e198d33d6941466a8c93ea86f5fae6f48b568) Hook up the DECRSTS sequence to the dispatch class. - [`e7a1b1c`](https://github.com/microsoft/terminal/commit/e7a1b1cccae7ec982606a7a7f2df185097539f93) Add a handler for restoring the color table. - [`a44a1da`](https://github.com/microsoft/terminal/commit/a44a1da7daae76887c2d8fdcc6058f03bece8107) Add some unit tests. - [`8042cf8`](https://github.com/microsoft/terminal/commit/8042cf8a84c3f23b44f71f8634c2d4fe34103cc1) Add terms to spelling bot's dictionary. - [`1c21fe9`](https://github.com/microsoft/terminal/commit/1c21fe94b8ab374ced97356fca893f86efb9d1bb) Use a lookup table for ColorFromRGB100 conversion. - [`3577283`](https://github.com/microsoft/terminal/commit/3577283dee7c69404d1a2d31aaed3d5bf0778989) Add DECRSTS to spelling bot's dictionary. - [`d778ff2`](https://github.com/microsoft/terminal/commit/d778ff29a709591daf750aee0805ee6bfe180452) Use til::at in place of gsl::at. ### 📊 Changes **11 files changed** (+414 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/expect/expect.txt` (+4 -0) 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+232 -0) 📝 `src/terminal/adapter/DispatchTypes.hpp` (+12 -0) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+2 -0) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+73 -0) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+4 -0) 📝 `src/terminal/adapter/termDispatch.hpp` (+3 -1) 📝 `src/terminal/parser/OutputStateMachineEngine.cpp` (+3 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.hpp` (+1 -0) 📝 `src/types/inc/utils.hpp` (+2 -0) 📝 `src/types/utils.cpp` (+78 -0) </details> ### 📄 Description This PR introduces the framework for the `DECRSTS` sequence which is used to restore terminal state reports. But to start with, I've just implemented the `DECCTR` color table report, which provides a way for applications to alter the terminal's color scheme. ## PR Checklist * [x] Closes #13132 * [x] CLA signed. * [x] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments I've added the functions for parsing DEC RGB and HLS color formats into the `Utils` class, where we've got all our other color parsing routines, since this functionality will eventually be needed in other VT protocols like Sixel and ReGIS. Since `DECRSTS` is a `DCS` sequence, this only works in conhost for now, or when using the experimental passthrough mode in Windows Terminal. ## Validation Steps Performed I've added a number of unit tests to check that the `DECCTR` report is being interpreted as expected. This includes various edge cases (e.g. omitted and out-of-range parameters), which I have confirmed to match the color parsing on a real VT240 terminal. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:34:41 +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#29404