Skip to content

VT margins are meant to be tracked separately for each page #19625

@j4james

Description

@j4james

Windows Terminal version

1.24.2812.0

Windows build number

10.0.19045.5371

Other Software

No response

Steps to reproduce

I first noticed this while trying out the Kermit demo script, but this is a simpler test case:

printf "\e#8\e[2 P\e[9;15r\e[1 P\e[999B\n\n\n\n\n\n\n"

That string has the following parts:

  1. Fill the screen with a DECALN sequence.
  2. Switch to page 2.
  3. Sets the top/bottom margins to 9;15.
  4. Switch back to page 1.
  5. Move the cursor down as far as it can go.
  6. Output a bunch of linefeeds to trigger a scroll.

Expected Behavior

The margins set on page 2 should have no effect on page 1, so the scrolling should occur at the very bottom of the page. The top part of the screen should be filled with Es from the DECALN, while the bottom lines should be blank where it has scrolled up.

Actual Behavior

We track the margins globally, so the margins set on page 2 apply to both pages, and thus the scrolling only occur within the 9..15 margin area. The top and bottom parts of the screen are filled with Es, and the middle section is blank.

It's not obvious from the documentation that margins are supposed to be tracked per-page, but the description of DECSTBM in the programmer's reference does hint at it with the wording "this control function sets the top and bottom margins for the current page" (emphasis mine). Interestingly they don't describe DECSLRM in the same way, but the rule applies to both. This has been confirmed with tests on the actual hardware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-VTVirtual Terminal sequence supportHelp WantedWe encourage anyone to jump in on these.Issue-BugIt either shouldn't be doing this or needs an investigation.Priority-2A description (P2)Product-ConhostFor issues in the Console codebaseProduct-TerminalThe new Windows Terminal.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions