Add support for the DECALN escape sequence #5134

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

Originally created by @j4james on GitHub (Nov 23, 2019).

Description of the new feature/enhancement

The DECALN escape sequence produces a test pattern that was used for adjusting screen alignment on the original VT terminals. I don't think it's of any real use in a modern terminal emulator, but it's needed to pass many of the tests in the Vttest suite.

This is how the control is defined in the VT510 Programmer Information manual:

This control function fills the complete screen area with a test pattern used for adjusting screen alignment ... DECALN sets the margins to the extremes of the page, and moves the cursor to the home position.

The VT100 and VT220 manuals define the fill pattern as an uppercase E, although later manuals are less specific, and the DEC STD 070 manual just says it's "implementation defined".

The DOC STD 070 manual does give a bit more detail about what should be reset though. In addition to clearing the margins, and moving the cursor position to home, it says the origin mode and rendition attributes should also be reset (although the latter was not actually true of the VT100).

As for the color attributes, if we're following the XTerm behaviour, then the colors should not be reset. However, note that the the test pattern should still be rendered with the default foreground and background colors, and not the active colors.

Proposed technical implementation details

This will require a new method to be added to the ITermDispatch interface, which can then be called from OutputStateMachineEngine::ActionEscDispatch when the intermediate char is # and the final char is 8.

The method itself can mostly be implemented with existing ConGetSet and AdaptDispatch calls. The only tricky bit is we'll need the new PrivateFillRegion API proposed in PR #3100 in order to fill the screen with the correct colors.

I've got a PR for this prepared already, but it's dependent on #3100 being approved first, otherwise I'll need to come up with another plan.

Originally created by @j4james on GitHub (Nov 23, 2019). # Description of the new feature/enhancement The [`DECALN`](https://vt100.net/docs/vt510-rm/DECALN.html) escape sequence produces a test pattern that was used for adjusting screen alignment on the original VT terminals. I don't think it's of any real use in a modern terminal emulator, but it's needed to pass many of the tests in the [Vttest](https://invisible-island.net/vttest/) suite. This is how the control is defined in the VT510 _Programmer Information_ manual: > This control function fills the complete screen area with a test pattern used for adjusting screen alignment ... DECALN sets the margins to the extremes of the page, and moves the cursor to the home position. The VT100 and VT220 manuals define the fill pattern as an uppercase E, although later manuals are less specific, and the _DEC STD 070_ manual just says it's "implementation defined". The _DOC STD 070_ manual does give a bit more detail about what should be reset though. In addition to clearing the margins, and moving the cursor position to home, it says the origin mode and rendition attributes should also be reset (although the latter was not actually true of the VT100). As for the color attributes, if we're following the XTerm behaviour, then the colors should not be reset. However, note that the the test pattern should still be rendered with the default foreground and background colors, and not the active colors. # Proposed technical implementation details This will require a new method to be added to the `ITermDispatch` interface, which can then be called from `OutputStateMachineEngine::ActionEscDispatch` when the intermediate char is `#` and the final char is `8`. The method itself can mostly be implemented with existing `ConGetSet` and `AdaptDispatch` calls. The only tricky bit is we'll need the new `PrivateFillRegion` API proposed in PR #3100 in order to fill the screen with the correct colors. I've got a PR for this prepared already, but it's dependent on #3100 being approved first, otherwise I'll need to come up with another plan.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5134