[PR #3968] [MERGED] Add support for the DECALN escape sequence #25582

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/3968
Author: @j4james
Created: 12/14/2019
Status: Merged
Merged: 12/17/2019
Merged by: @undefined

Base: masterHead: feature-decaln


📝 Commits (2)

  • eda9d08 Add support for the DECALN escape sequence.
  • cc8d0cc Add a screen buffer test to verify the DECALN behaviour.

📊 Changes

9 files changed (+118 additions, -1 deletions)

View changed files

📝 src/host/ut_host/ScreenBufferTests.cpp (+61 -0)
📝 src/terminal/adapter/ITermDispatch.hpp (+1 -0)
📝 src/terminal/adapter/adaptDispatch.cpp (+36 -0)
📝 src/terminal/adapter/adaptDispatch.hpp (+1 -0)
📝 src/terminal/adapter/termDispatch.hpp (+1 -0)
📝 src/terminal/parser/OutputStateMachineEngine.cpp (+14 -0)
📝 src/terminal/parser/OutputStateMachineEngine.hpp (+2 -1)
📝 src/terminal/parser/telemetry.cpp (+1 -0)
📝 src/terminal/parser/telemetry.hpp (+1 -0)

📄 Description

Summary of the Pull Request

This adds support for the DECALN escape sequence, which produces a kind of test pattern, originally used on VT terminals to adjust the screen alignment. It's needed to pass several of the tests in the Vttest suite.

PR Checklist

  • Closes How to run an executable in Terminal from a batch file (#3671)
  • 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: #xxx

Detailed Description of the Pull Request / Additional comments

To start with, the ActionEscDispatch method in the OutputStateMachineEngine needed to be extended to check for a new intermediate type (#). Then when that intermediate is followed by an 8, it dispatches to a new ScreenAlignmentPattern method in the ITermDispatch interface.

The implementation of the ScreenAlignmentPattern itself is fairly simple. It uses the recently added PrivateFillRegion API to fill the screen with the character E using default attributes. Then in addition to that, a bunch of VT properties are reset:

  • The meta/extended attributes are reset (although the active colors must be left unchanged).
  • The origin mode is set to absolute positioning.
  • The scrolling margins are cleared.
  • The cursor position is moved to home.

Validation Steps Performed

I've added a screen buffer test that makes sure the DECALN sequence fills the screen with the correct character and attributes, and that the above mentioned properties are all updated appropriately.

I've also tested in Vttest, and confirmed that the first two pages of the Test of cursor movements are now showing the frame of E's that are expected there.


🔄 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/3968 **Author:** [@j4james](https://github.com/j4james) **Created:** 12/14/2019 **Status:** ✅ Merged **Merged:** 12/17/2019 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `feature-decaln` --- ### 📝 Commits (2) - [`eda9d08`](https://github.com/microsoft/terminal/commit/eda9d08832bca1474aec789f95612fc75315bd81) Add support for the DECALN escape sequence. - [`cc8d0cc`](https://github.com/microsoft/terminal/commit/cc8d0ccc8cd46941efd8faea2b5a0608554f0caf) Add a screen buffer test to verify the DECALN behaviour. ### 📊 Changes **9 files changed** (+118 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+61 -0) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+1 -0) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+36 -0) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+1 -0) 📝 `src/terminal/adapter/termDispatch.hpp` (+1 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.cpp` (+14 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.hpp` (+2 -1) 📝 `src/terminal/parser/telemetry.cpp` (+1 -0) 📝 `src/terminal/parser/telemetry.hpp` (+1 -0) </details> ### 📄 Description ## Summary of the Pull Request This adds support for the [`DECALN`](https://vt100.net/docs/vt510-rm/DECALN.html) escape sequence, which produces a kind of test pattern, originally used on VT terminals to adjust the screen alignment. It's needed to pass several of the tests in the [Vttest](https://invisible-island.net/vttest/) suite. ## PR Checklist * [x] Closes #3671 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] 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: #xxx ## Detailed Description of the Pull Request / Additional comments To start with, the `ActionEscDispatch` method in the `OutputStateMachineEngine` needed to be extended to check for a new intermediate type (`#`). Then when that intermediate is followed by an `8`, it dispatches to a new `ScreenAlignmentPattern` method in the `ITermDispatch` interface. The implementation of the `ScreenAlignmentPattern` itself is fairly simple. It uses the recently added `PrivateFillRegion` API to fill the screen with the character `E` using default attributes. Then in addition to that, a bunch of VT properties are reset: * The meta/extended attributes are reset (although the active colors must be left unchanged). * The origin mode is set to absolute positioning. * The scrolling margins are cleared. * The cursor position is moved to home. ## Validation Steps Performed I've added a screen buffer test that makes sure the `DECALN` sequence fills the screen with the correct character and attributes, and that the above mentioned properties are all updated appropriately. I've also tested in Vttest, and confirmed that the first two pages of the _Test of cursor movements_ are now showing the frame of E's that are expected there. --- <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:10:25 +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#25582