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

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

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

State: closed
Merged: Yes


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.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/3968 **State:** closed **Merged:** Yes --- ## 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.
claunia added the pull-request label 2026-01-31 09:10:27 +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#25587