[PR #1978] [MERGED] Add support for XTPUSHSGR / XTPOPSGR #24737

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/1978
Author: @jazzdelightsme
Created: 7/15/2019
Status: Merged
Merged: 2/18/2021
Merged by: @DHowett

Base: mainHead: user/danthom/wip/xtpushsgr


📝 Commits (4)

  • ffcb365 Implement XTPUSHSGR, XTPOPSGR
  • 34547cf Fix static analysis complaints about possible exceptions.
  • 48c9720 PR feedback: don't need Set...From; sort Csi codes
  • e4c9ca6 PR feedback

📊 Changes

22 files changed (+641 additions, -1 deletions)

View changed files

📝 .github/actions/spelling/expect/expect.txt (+2 -0)
📝 src/cascadia/TerminalCore/ITerminalApi.hpp (+3 -0)
📝 src/cascadia/TerminalCore/Terminal.hpp (+7 -0)
📝 src/cascadia/TerminalCore/TerminalApi.cpp (+28 -0)
📝 src/cascadia/TerminalCore/TerminalDispatch.hpp (+3 -0)
📝 src/cascadia/TerminalCore/TerminalDispatchGraphics.cpp (+10 -0)
📝 src/terminal/adapter/DispatchTypes.hpp (+34 -0)
📝 src/terminal/adapter/ITermDispatch.hpp (+3 -0)
📝 src/terminal/adapter/adaptDispatch.hpp (+5 -0)
📝 src/terminal/adapter/adaptDispatchGraphics.cpp (+45 -0)
📝 src/terminal/adapter/termDispatch.hpp (+3 -0)
📝 src/terminal/adapter/ut_adapter/Adapter.UnitTests.vcxproj (+3 -0)
📝 src/terminal/adapter/ut_adapter/adapterTest.cpp (+138 -0)
📝 src/terminal/parser/OutputStateMachineEngine.cpp (+13 -0)
📝 src/terminal/parser/OutputStateMachineEngine.hpp (+5 -1)
📝 src/terminal/parser/telemetry.cpp (+2 -0)
📝 src/terminal/parser/telemetry.hpp (+2 -0)
src/types/inc/sgrStack.hpp (+114 -0)
📝 src/types/lib/types.vcxproj (+2 -0)
📝 src/types/lib/types.vcxproj.filters (+6 -0)

...and 2 more files

📄 Description

Summary of the Pull Request

Implement the XTPUSHSGR and XTPOPSGR control sequences (see #1796).

This change adds a new pair of methods to ITermDispatch:
PushGraphicsRendition and PopGraphicsRendition, and then plumbs the
change through AdaptDispatch, TerminalDispatch, ITerminalApi and
TerminalApi.

The stack logic is encapsulated in the SgrStack class, to allow it to
be reused between the two APIs (AdaptDispatch and TerminalDispatch).

Like xterm, only ten levels of nesting are supported.

The stack is implemented as a "ring stack": if you push when the stack
is full, the bottom of the stack will be dropped to make room.

Partial pushes (see the description of XTPUSHSGR in Issue #1796) are
implemented per xterm spec.

Validation Steps Performed

Tests added, plus manual verification of the feature.

Closes #1796


🔄 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/1978 **Author:** [@jazzdelightsme](https://github.com/jazzdelightsme) **Created:** 7/15/2019 **Status:** ✅ Merged **Merged:** 2/18/2021 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `main` ← **Head:** `user/danthom/wip/xtpushsgr` --- ### 📝 Commits (4) - [`ffcb365`](https://github.com/microsoft/terminal/commit/ffcb36523525eb3ff0df84b7ee5071c089f34cdd) Implement XTPUSHSGR, XTPOPSGR - [`34547cf`](https://github.com/microsoft/terminal/commit/34547cf241da0c8dc4b903bae5e6cc544501f667) Fix static analysis complaints about possible exceptions. - [`48c9720`](https://github.com/microsoft/terminal/commit/48c97206898b4f82dc9d52cb42e80cbfb27cd08d) PR feedback: don't need Set...From; sort Csi codes - [`e4c9ca6`](https://github.com/microsoft/terminal/commit/e4c9ca60fecc0952d7f9163da0799201a039926d) PR feedback ### 📊 Changes **22 files changed** (+641 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/expect/expect.txt` (+2 -0) 📝 `src/cascadia/TerminalCore/ITerminalApi.hpp` (+3 -0) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+7 -0) 📝 `src/cascadia/TerminalCore/TerminalApi.cpp` (+28 -0) 📝 `src/cascadia/TerminalCore/TerminalDispatch.hpp` (+3 -0) 📝 `src/cascadia/TerminalCore/TerminalDispatchGraphics.cpp` (+10 -0) 📝 `src/terminal/adapter/DispatchTypes.hpp` (+34 -0) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+3 -0) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+5 -0) 📝 `src/terminal/adapter/adaptDispatchGraphics.cpp` (+45 -0) 📝 `src/terminal/adapter/termDispatch.hpp` (+3 -0) 📝 `src/terminal/adapter/ut_adapter/Adapter.UnitTests.vcxproj` (+3 -0) 📝 `src/terminal/adapter/ut_adapter/adapterTest.cpp` (+138 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.cpp` (+13 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.hpp` (+5 -1) 📝 `src/terminal/parser/telemetry.cpp` (+2 -0) 📝 `src/terminal/parser/telemetry.hpp` (+2 -0) ➕ `src/types/inc/sgrStack.hpp` (+114 -0) 📝 `src/types/lib/types.vcxproj` (+2 -0) 📝 `src/types/lib/types.vcxproj.filters` (+6 -0) _...and 2 more files_ </details> ### 📄 Description ## Summary of the Pull Request Implement the `XTPUSHSGR` and `XTPOPSGR` control sequences (see #1796). This change adds a new pair of methods to `ITermDispatch`: `PushGraphicsRendition` and `PopGraphicsRendition`, and then plumbs the change through `AdaptDispatch`, `TerminalDispatch`, `ITerminalApi` and `TerminalApi`. The stack logic is encapsulated in the `SgrStack` class, to allow it to be reused between the two APIs (`AdaptDispatch` and `TerminalDispatch`). Like xterm, only ten levels of nesting are supported. The stack is implemented as a "ring stack": if you push when the stack is full, the bottom of the stack will be dropped to make room. Partial pushes (see the description of `XTPUSHSGR` in Issue #1796) are implemented per xterm spec. ## Validation Steps Performed Tests added, plus manual verification of the feature. Closes #1796 --- <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:05:05 +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#24737