CNL and CPL should be constrained by margins #4098

Closed
opened 2026-01-30 23:37:54 +00:00 by claunia · 3 comments
Owner

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

Environment

Windows build number: Version 10.0.18362.295
Also test with a recent commit 7faf3342e0

Steps to reproduce

In a conhost WSL shell, execute the following command:

echo -e "\e[6;19r\e[12H\e[99ECNL\e[12H\e[99FCPL\e[r"

This does the following:

  • sets the top and bottom DECSTBM margins to 6 and 19
  • moves to line 12 (i.e. inside the margins)
  • executes the CNL sequence with a count of 99, to move down 99 lines
  • writes out CNL
  • moves back to line 12
  • executes the CPL sequence with a count of 99, to move up 99 lines
  • writes out CPL

Expected behavior

I can't find spec text to back this up, but in both XTerm and the Gnome VTE terminal these commands are constrained by the DECSTBM margins, so CNL doesn't move below row 19 (the bottom margin), and CPL doesn't move above row 6 (the top margin).

This is what the output looks like in XTerm:

image

Actual behavior

The margins are ignored by the Windows console, so CNL moves all the way to the bottom of the viewport, and CPL moves all the way to the top of the viewport.

image

I can't say for certain that this is wrong, but I think we should probably be trying to match the XTerm and VTE behaviour unless there is convincing evidence that they've got it wrong.

Originally created by @j4james on GitHub (Sep 27, 2019). # Environment Windows build number: Version 10.0.18362.295 Also test with a recent commit 7faf3342e0187841d590fd018452c5c69fd52271 # Steps to reproduce In a conhost WSL shell, execute the following command: echo -e "\e[6;19r\e[12H\e[99ECNL\e[12H\e[99FCPL\e[r" This does the following: - sets the top and bottom [`DECSTBM`](https://vt100.net/docs/vt510-rm/DECSTBM.html) margins to 6 and 19 - moves to line 12 (i.e. inside the margins) - executes the [`CNL`](https://vt100.net/docs/vt510-rm/CNL.html) sequence with a count of 99, to move down 99 lines - writes out *CNL* - moves back to line 12 - executes the [`CPL`](https://vt100.net/docs/vt510-rm/CPL.html) sequence with a count of 99, to move up 99 lines - writes out *CPL* # Expected behavior I can't find spec text to back this up, but in both XTerm and the Gnome VTE terminal these commands are constrained by the `DECSTBM` margins, so `CNL` doesn't move below row 19 (the bottom margin), and `CPL` doesn't move above row 6 (the top margin). This is what the output looks like in XTerm: ![image](https://user-images.githubusercontent.com/4181424/65731028-f24ab800-e0bb-11e9-8517-330c32951445.png) # Actual behavior The margins are ignored by the Windows console, so `CNL` moves all the way to the bottom of the viewport, and `CPL` moves all the way to the top of the viewport. ![image](https://user-images.githubusercontent.com/4181424/65731034-f971c600-e0bb-11e9-9f5d-8cab58733edf.png) I can't say for certain that this is wrong, but I think we should probably be trying to match the XTerm and VTE behaviour unless there is convincing evidence that they've got it wrong.
Author
Owner

@DHowett-MSFT commented on GitHub (Sep 27, 2019):

Yeah, matching XTerm and VTE sounds correct to me!

@DHowett-MSFT commented on GitHub (Sep 27, 2019): Yeah, matching XTerm and VTE sounds correct to me!
Author
Owner

@ghost commented on GitHub (Jan 27, 2020):

:tada:This issue was addressed in #3628, which has now been successfully released as Windows Terminal Preview v0.8.10261.0.🎉

Handy links:

@ghost commented on GitHub (Jan 27, 2020): :tada:This issue was addressed in #3628, which has now been successfully released as `Windows Terminal Preview v0.8.10261.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.8.10261.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Feb 13, 2020):

:tada:This issue was addressed in #3628, which has now been successfully released as Windows Terminal Preview v0.9.433.0.🎉

Handy links:

@ghost commented on GitHub (Feb 13, 2020): :tada:This issue was addressed in #3628, which has now been successfully released as `Windows Terminal Preview v0.9.433.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.9.433.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4098