Alt buffer should share more state with main buffer #4951

Closed
opened 2026-01-31 00:01:25 +00:00 by claunia · 2 comments
Owner

Originally created by @j4james on GitHub (Nov 12, 2019).

Environment

Windows build number: Version 10.0.18362.356

Steps to reproduce

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

printf "\ec\e[1;15r\e[3g\e[1;20H\eH\e[?25l\e[9;20H\e[?1049hstart\r\e[99Bmargin\e[H\ttab\n"

This initialises a number of terminal properties.

  • The scrolling margins are set to 1:15 (DECSTBM).
  • The tabstops are cleared and then a single tabstop is set at column 20 (TBC/HTS).
  • The cursor blinking is disabled (DECTCEM).
  • The cursor position is set to line 9 column 20 (CUP).

It then switches to the alternate screen buffer (private mode 1049) and "tests" the state.

  • The text "start" is output to indicate the starting position.
  • The cursor is moved down 99 lines (CUD), and the text "margin" is output to indicate the bottom margin position.
  • The cursor is moved to the home position (CUP) and a tab is output, followed by the text "tab" to indicate the position of the tab stop.

Expected behavior

I would expect all of the initial state to be inherited by the alt buffer, producing the following results:

  • The "start" text should be on line 9, column 20, i.e. the position before the switch to the alt buffer.
  • The "margin" text should be on line 15, the bottom margin.
  • The "tab" text should be in column 20, the position of the tab stop that was set.
  • The cursor should be invisible.

Here's what the output looks like in XTerm:

image

Actual behavior

When switching to the alt buffer in conhost, we reset all those properties, producing the following results:

  • The "start" text is in the top left corner.
  • The "margin" text is at the bottom of the screen.
  • The "tab" text is in column 9.
  • The cursor is visible.

Here's what our output looks like:

image

The reason for this behaviour is because these properties are part of the SCREEN_INFORMATION class, and the alternate buffer is implemented as a separate instance of that class, when it should really be sharing much of that state with the main buffer.

The scroll margins are a little more complicated, since those properties are also duplicated in the AdaptDispatch class. And this can result in some weirdness when switching to the alt buffer since the two sets of values can end up out of sync.

Originally created by @j4james on GitHub (Nov 12, 2019). # Environment Windows build number: Version 10.0.18362.356 # Steps to reproduce Open a WSL shell in conhost and execute the following command: printf "\ec\e[1;15r\e[3g\e[1;20H\eH\e[?25l\e[9;20H\e[?1049hstart\r\e[99Bmargin\e[H\ttab\n" This initialises a number of terminal properties. - The scrolling margins are set to 1:15 (`DECSTBM`). - The tabstops are cleared and then a single tabstop is set at column 20 (`TBC`/`HTS`). - The cursor blinking is disabled (`DECTCEM`). - The cursor position is set to line 9 column 20 (`CUP`). It then switches to the alternate screen buffer (private mode 1049) and "tests" the state. - The text "start" is output to indicate the starting position. - The cursor is moved down 99 lines (`CUD`), and the text "margin" is output to indicate the bottom margin position. - The cursor is moved to the home position (`CUP`) and a tab is output, followed by the text "tab" to indicate the position of the tab stop. # Expected behavior I would expect all of the initial state to be inherited by the alt buffer, producing the following results: - The "start" text should be on line 9, column 20, i.e. the position before the switch to the alt buffer. - The "margin" text should be on line 15, the bottom margin. - The "tab" text should be in column 20, the position of the tab stop that was set. - The cursor should be invisible. Here's what the output looks like in XTerm: ![image](https://user-images.githubusercontent.com/4181424/68713559-08da9f00-0596-11ea-8b6b-576c75d74042.png) # Actual behavior When switching to the alt buffer in conhost, we reset all those properties, producing the following results: - The "start" text is in the top left corner. - The "margin" text is at the bottom of the screen. - The "tab" text is in column 9. - The cursor is visible. Here's what our output looks like: ![image](https://user-images.githubusercontent.com/4181424/68713572-1132da00-0596-11ea-952a-59f732829014.png) The reason for this behaviour is because these properties are part of the `SCREEN_INFORMATION` class, and the alternate buffer is implemented as a separate instance of that class, when it should really be sharing much of that state with the main buffer. The scroll margins are a little more complicated, since those properties are also duplicated in the `AdaptDispatch` class. And this can result in some weirdness when switching to the alt buffer since the two sets of values can end up out of sync.
claunia added the Product-ConhostResolution-Fix-CommittedIssue-TaskArea-VT labels 2026-01-31 00:01:25 +00:00
Author
Owner

@ghost commented on GitHub (Aug 31, 2021):

:tada:This issue was addressed in #10843, which has now been successfully released as Windows Terminal Preview v1.10.2383.0.🎉

Handy links:

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

@ghost commented on GitHub (Aug 31, 2021):

:tada:This issue was addressed in #10843, which has now been successfully released as Windows Terminal Preview v1.11.2421.0.🎉

Handy links:

@ghost commented on GitHub (Aug 31, 2021): :tada:This issue was addressed in #10843, which has now been successfully released as `Windows Terminal Preview v1.11.2421.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.11.2421.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?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#4951