-
Notifications
You must be signed in to change notification settings - Fork 9k
Description
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:
- Fill the screen with a
DECALNsequence. - Switch to page 2.
- Sets the top/bottom margins to 9;15.
- Switch back to page 1.
- Move the cursor down as far as it can go.
- 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.