Skip to content

Reset to Initial State (RIS) doesn't reset very much #159

@j4james

Description

@j4james

Your Windows build number:

Microsoft Windows [Version 10.0.16299.371]

What you're doing and what's happening:

I was experimenting with the RIS (Reset to Initial State) escape sequence, ESC c, to see which properties are actually reset by it. It turns out that quite a lot of properties aren't reset in the Windows console (at least the version that I have).

  • Scroll margins (DECSTBM)
  • Saved cursor position (DECSC and ANSISC)
  • User-defined tab stops (HTS) - I've mentioned this before in issue Unexpected behaviour when setting tab stops #140
  • Cursor visibility (DECTCEM)
  • Cursor blinking state (ATT160)
  • The window title
  • Cursor key application mode (DECCKM)

I've also tested on XTerm, which does reset most of these properties. Below are a few test cases comparing the behaviour between XTerm (on the left) and the Windows console (on the right).

Scroll margins: If RIS reset the scroll margins, this should ouput on line 8, and not line 2.

printf "\e[1;2r\ec\n\n\n\n\n\n\nLine 8?\e[r"; read -n1

image

Saved cursor position (DECSC): If RIS resets the saved cursor position, this should output in the top left of the screen, and not offset at row 3, column 6.

printf "\e[3;6H\e7\ec\e8Top left?\n"

image

Saved cursor position (ANSISC): Again if RIS resets the saved cursor position, this should output in the top left of the screen, and not offset at row 3, column 6.

printf "\e[3;6H\e[s\ec\e[uTop left?\n"

image

User-defined tab stops: If RIS resets the tab stops, this should output at column 8, not column 2.

printf "\e[H  \eH\ec\t\e[gColumn 8?\n"

image

Cursor visibility: If RIS resets the cursor visibility, this should show a visible cursor.

printf "\e[?25l\ecCursor visible?"; read -n1; printf "\e[?25h"

image

Cursor blinking: If RIS resets the cursor blinking, this should show a blinking cursor.

printf "\e[?12l\ecCursor blinking?"; read -n1; printf "\e[?12h"

This is not really something that can be shown in a screenshot, but I'm seeing a static cursor in the Windows console. I couldn't test on Linux because the ATT160 sequence doesn't appear to be supported on any of the Linux terminal emulators that I tried.

Window title: If RIS resets the title, this should not leave the title displaying the letter X. This is one case that isn't reset by XTerm either (or any of the other Linux emulators I tried).

printf "\e]2;X\a\ecTitle not X?"; read -n1

image

Cursor key application mode: If RIS resets the cursor key mode, this test should generate output in the form ^[[A^[[B^[[C^[[D, and not ^[OA^[OB^[OC^[OC.

printf "\e[?1h\ecPress some cursor keys:\n"; read

image

I'd expect similar behaviour for the keypad application mode (DECKPAM), but that doesn't appear to be working in the Windows console at all, so I couldn't test whether the reset has any effect on it.

What's wrong / what should be happening instead:

The VT100 manual defines the RIS command as: "Resets the VT100 to its initial state, i.e. the state it has after it is powered on." Given that definition, I would have expected all of the above mentioned properties to be reset. That said, I could understand the window title not being reset if nobody else supports that either (and I guess none of the VT terminals would have had a window title anyway).

Metadata

Metadata

Assignees

Labels

Product-ConhostFor issues in the Console codebaseResolution-Fix-AvailableIt's available in an Insiders build or a release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions