[PR #891] [MERGED] Add support for OSC 10 and 11 to set the default colors #24362

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/891
Author: @Jaykul
Created: 5/18/2019
Status: Merged
Merged: 5/24/2019
Merged by: @miniksa

Base: masterHead: dev/jaykul/SettableDefaultColors


📝 Commits (10+)

  • 96dfd49 Support OSC to set default background and foreground colors
  • cd9367a Update the Terminal theme when the background changes
  • d0656b2 Fix whitespace per code-review
  • d92117d Add Documentation Comments
  • 205bfe3 Update Telemetry codes per code review
  • 64314fb Add Unit Tests for OSC ForegroundColor and BackgroundColor
  • c38d8bc Add a couple additional test cases
  • 412a34d Minor doc and whitespace change per PR review
  • 8ca3a98 Update comment help per code review
  • 678f531 Add another OSC 10 & 11 test case, improve output

📊 Changes

23 files changed (+482 additions, -72 deletions)

View changed files

📝 src/cascadia/TerminalControl/TermControl.cpp (+49 -32)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -0)
📝 src/cascadia/TerminalCore/ITerminalApi.hpp (+3 -0)
📝 src/cascadia/TerminalCore/Terminal.cpp (+9 -0)
📝 src/cascadia/TerminalCore/Terminal.hpp (+5 -1)
📝 src/cascadia/TerminalCore/TerminalApi.cpp (+32 -1)
📝 src/cascadia/TerminalCore/TerminalDispatch.cpp (+23 -1)
📝 src/cascadia/TerminalCore/TerminalDispatch.hpp (+3 -0)
📝 src/host/getset.cpp (+56 -0)
📝 src/host/getset.h (+6 -0)
📝 src/host/outputStream.cpp (+24 -0)
📝 src/host/outputStream.hpp (+4 -0)
📝 src/host/ut_host/ScreenBufferTests.cpp (+124 -0)
📝 src/terminal/adapter/ITermDispatch.hpp (+2 -1)
📝 src/terminal/adapter/adaptDispatch.cpp (+70 -21)
📝 src/terminal/adapter/adaptDispatch.hpp (+4 -2)
📝 src/terminal/adapter/conGetSet.hpp (+2 -0)
📝 src/terminal/adapter/termDispatch.hpp (+2 -0)
📝 src/terminal/adapter/ut_adapter/adapterTest.cpp (+28 -0)
📝 src/terminal/parser/OutputStateMachineEngine.cpp (+23 -10)

...and 3 more files

📄 Description

Add support for OSC 10 and 11 to set the default colors

Supports setting the rgb value for the default foreground and background (but no support for querying yet, same as OSC 4)

PR Checklist

  • Closes When scrolling vim, text is not displayed properly. (#317)
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be 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: #317

This adds support for OSC 10 to set the default foreground color and OSC 11 to set the default background color (just as if they were set in the profiles.json, except that the settings are not changes, so they can be reloaded).

I have not implemented querying (which is also mentioned in #317), so this only addresses one item in the list.

I have not really added any unit tests -- I'm happy to do so, but unsure where they should go, or what they look like. I found some mocks for the other OSC codes, and implemented those, but didn't spot tests.


🔄 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/891 **Author:** [@Jaykul](https://github.com/Jaykul) **Created:** 5/18/2019 **Status:** ✅ Merged **Merged:** 5/24/2019 **Merged by:** [@miniksa](https://github.com/miniksa) **Base:** `master` ← **Head:** `dev/jaykul/SettableDefaultColors` --- ### 📝 Commits (10+) - [`96dfd49`](https://github.com/microsoft/terminal/commit/96dfd49e9581e62ecfe766dc4546c7e8d658638e) Support OSC to set default background and foreground colors - [`cd9367a`](https://github.com/microsoft/terminal/commit/cd9367ac6282d05fad8f83fe8c7f51eb4dc32c1e) Update the Terminal theme when the background changes - [`d0656b2`](https://github.com/microsoft/terminal/commit/d0656b2453ef50749254510da9d01ef933b2d605) Fix whitespace per code-review - [`d92117d`](https://github.com/microsoft/terminal/commit/d92117dc121c03b00c1a0e1869a60e71683c2178) Add Documentation Comments - [`205bfe3`](https://github.com/microsoft/terminal/commit/205bfe3dc5e6e744709925e2b98091ea9f96c7e5) Update Telemetry codes per code review - [`64314fb`](https://github.com/microsoft/terminal/commit/64314fb5a93a5783cf2f33da02a3852e473ad59e) Add Unit Tests for OSC ForegroundColor and BackgroundColor - [`c38d8bc`](https://github.com/microsoft/terminal/commit/c38d8bced87c7858fd89ba6542e48c2cbe8c845e) Add a couple additional test cases - [`412a34d`](https://github.com/microsoft/terminal/commit/412a34dddfbb18effd900927b55711dd6c40ec25) Minor doc and whitespace change per PR review - [`8ca3a98`](https://github.com/microsoft/terminal/commit/8ca3a98cc0a747210be037c2a3b0342698b6733f) Update comment help per code review - [`678f531`](https://github.com/microsoft/terminal/commit/678f531a244b9b6dac8b2eff69572383a1029597) Add another OSC 10 & 11 test case, improve output ### 📊 Changes **23 files changed** (+482 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+49 -32) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -0) 📝 `src/cascadia/TerminalCore/ITerminalApi.hpp` (+3 -0) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+9 -0) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+5 -1) 📝 `src/cascadia/TerminalCore/TerminalApi.cpp` (+32 -1) 📝 `src/cascadia/TerminalCore/TerminalDispatch.cpp` (+23 -1) 📝 `src/cascadia/TerminalCore/TerminalDispatch.hpp` (+3 -0) 📝 `src/host/getset.cpp` (+56 -0) 📝 `src/host/getset.h` (+6 -0) 📝 `src/host/outputStream.cpp` (+24 -0) 📝 `src/host/outputStream.hpp` (+4 -0) 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+124 -0) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+2 -1) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+70 -21) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+4 -2) 📝 `src/terminal/adapter/conGetSet.hpp` (+2 -0) 📝 `src/terminal/adapter/termDispatch.hpp` (+2 -0) 📝 `src/terminal/adapter/ut_adapter/adapterTest.cpp` (+28 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.cpp` (+23 -10) _...and 3 more files_ </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Add support for OSC 10 and 11 to set the default colors Supports setting the rgb value for the default foreground and background (but no support for querying yet, same as OSC 4) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #317 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [x] Requires documentation to be updated * [x] 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: #317 <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> This adds support for OSC 10 to set the default foreground color and OSC 11 to set the default background color (just as if they were set in the profiles.json, except that the settings are not changes, so they can be reloaded). I have not implemented querying (which is also mentioned in #317), so this only addresses one item in the list. I have not really added any unit tests -- I'm happy to do so, but unsure where they should go, or what they look like. I found some mocks for the other OSC codes, and implemented those, but didn't spot tests. --- <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:02:49 +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#24362