LF shouldn't scroll the viewport when below the bottom margin #3741

Open
opened 2026-01-30 23:28:54 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Sep 4, 2019).

Environment

Windows build number: Version 10.0.18362.239

Steps to reproduce

Open a WSL conhost shell, and execute the following command:

printf "\e[1;2r\e[999HBottom line?\n\n\n\e[r"

This sets the DECSTBM margins to the top two lines, moves the cursor position to the very bottom of the screen (i.e. below the bottom margin), and then writes out "Bottom line?" followed by 3 line feeds, and finally resets the margins.

Expected behavior

The line feeds should not cause the viewport to scroll when below the bottom margin, so the "Bottom line?" text should remain on the last line of the screen.

This is what the above test case looks like in XTerm:

image

And here's an extract from the DEC STD 070 documentation for the LF control, explaining that behaviour:

If the Active Position is below the Bottom Margin when this control is executed (as the result of absolute cursor positioning) it will still move downward by one line and no scrolling will occur. In this case, the Active Position will not move beyond the bottom line of the display.

Actual behavior

In the Windows console, the line feeds cause the viewport to scroll up, just as they would if there were no margins set, so the "Bottom line?" actually ends up 3 lines from the bottom, and the top line has scrolled out of view.

image

Originally created by @j4james on GitHub (Sep 4, 2019). # Environment ```none Windows build number: Version 10.0.18362.239 ``` # Steps to reproduce Open a WSL conhost shell, and execute the following command: printf "\e[1;2r\e[999HBottom line?\n\n\n\e[r" This sets the DECSTBM margins to the top two lines, moves the cursor position to the very bottom of the screen (i.e. below the bottom margin), and then writes out "Bottom line?" followed by 3 line feeds, and finally resets the margins. # Expected behavior The line feeds should not cause the viewport to scroll when below the bottom margin, so the "Bottom line?" text should remain on the last line of the screen. This is what the above test case looks like in XTerm: ![image](https://user-images.githubusercontent.com/4181424/64267231-f147c000-cf2d-11e9-9195-a5e93d617086.png) And here's an extract from the DEC STD 070 documentation for the LF control, explaining that behaviour: > If the Active Position is below the Bottom Margin when this control is executed (as the result of absolute cursor positioning) it will still move downward by one line and no scrolling will occur. In this case, the Active Position will not move beyond the bottom line of the display. # Actual behavior In the Windows console, the line feeds cause the viewport to scroll up, just as they would if there were no margins set, so the "Bottom line?" actually ends up 3 lines from the bottom, and the top line has scrolled out of view. ![image](https://user-images.githubusercontent.com/4181424/64267424-45eb3b00-cf2e-11e9-9f7b-39accc47c8cc.png)
claunia added the Product-ConhostResolution-Fix-CommittedIssue-BugArea-VT labels 2026-01-30 23:28:54 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3741