Skip to content

ICH and DCH shouldn't be affected by vertical margins #2543

@j4james

Description

@j4james

Environment

Windows build number: Version 10.0.18362.239

Steps to reproduce

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

printf "\e[3;4r\e[5@\e[r\n"

This sets the vertical scroll margins to lines 3 to 4, inserts 5 characters at the start of the first line (using the ICH escape sequence), and then resets the margins again.

Now open a new WSL conhost shell, and execute the following command:

printf "\e[3;4r\e[5P\e[r\n"

This sets the vertical scroll margins to lines 3 to 4, deletes 5 characters from the start of the first line (using the DCH escape sequence), and then resets the margins again.

Expected behavior

In the first case I'd expect to see the first line indented by 5 characters. In the second case I'd expect to see 5 characters deleted from the first line.

This is how those commands look in XTerm:

image

Actual behavior

Both commands are ignored, because they're executed above the top of the scroll margins.

Now I can't say for sure that this is the wrong behaviour. The VT510 documentation says that both ICH and DCH have "no effect outside the scrolling margins", but it's possible they were referring only to the horizontal margins in that particular context. If you look at the DEC STD 070 manual, the wording is a lot clearer: "If the Active Position is outside the left or right margins, this control is ignored."

However, just to confuse things some more, the DEC STD 070 manual also provides a kind of pseudo code algorithm for each command, and the algorithm for ICH seems to suggest that it is limited by both the horizontal and vertical margins, while DCH is only affected by the horizontal margins. I suspect that might just be a bug in the ICH algorithm, but who knows.

Bottom line: the documentation isn't particularly clear about this, but I do know that we don't currently match XTerm's behaviour.

Metadata

Metadata

Assignees

Labels

Area-VTVirtual Terminal sequence supportIssue-BugIt either shouldn't be doing this or needs an investigation.Needs-Tag-FixDoesn't match tag requirementsProduct-ConhostFor issues in the Console codebaseResolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions