RIS doesn't propagate through ConPTY to clear connected terminal #3820

Closed
opened 2026-01-30 23:30:48 +00:00 by claunia · 7 comments
Owner

Originally created by @watzon on GitHub (Sep 10, 2019).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: Win32NT 10.0.18362.0 Microsoft Windows NT 10.0.18362.0
Windows Terminal version (if applicable): 0.4.2382.0
Ubuntu WSL version: 1804.2019.521.0

Steps to reproduce

Enter printf "\033c" while using WSL in Windows Terminal

Expected behavior

Console should be cleared, as when using any standard Linux terminal

Actual behavior

Nothing changes.

Could be related to #140, but it seems like that has been fixed.

Originally created by @watzon on GitHub (Sep 10, 2019). Originally assigned to: @zadjii-msft on GitHub. # Environment ```none Windows build number: Win32NT 10.0.18362.0 Microsoft Windows NT 10.0.18362.0 Windows Terminal version (if applicable): 0.4.2382.0 Ubuntu WSL version: 1804.2019.521.0 ``` # Steps to reproduce Enter `printf "\033c"` while using WSL in Windows Terminal # Expected behavior Console should be cleared, as when using any standard Linux terminal # Actual behavior Nothing changes. Could be related to #140, but it seems like that has been fixed.
Author
Owner

@zadjii-msft commented on GitHub (Sep 10, 2019):

Is this maybe #2307, which was fixed in #2367?

cc @j4james

@zadjii-msft commented on GitHub (Sep 10, 2019): Is this maybe #2307, which was fixed in #2367? cc @j4james
Author
Owner

@j4james commented on GitHub (Sep 11, 2019):

@zadjii-msft Yes and no. PR #2367 was just a conhost fix. So while it should improve the behaviour of RIS in the Windows Terminal (e.g. the screen should at least clear), it won't be perfect. Things like the backbuffer clearing would assumedly need special case handling through conpty. I don't know much about that side of things though.

@j4james commented on GitHub (Sep 11, 2019): @zadjii-msft Yes and no. PR #2367 was just a conhost fix. So while it should improve the behaviour of RIS in the Windows Terminal (e.g. the screen should at least clear), it won't be perfect. Things like the backbuffer clearing would assumedly need special case handling through conpty. I don't know much about that side of things though.
Author
Owner

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

:tada:This issue was addressed in #4433, 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 #4433, 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)
Author
Owner

@mixmastamyk commented on GitHub (Feb 16, 2020):

This allowed CSI 3 J but seems to have forgotten RIS? It least RIS doesn't seem to work for me on the new build mentioned above.

@mixmastamyk commented on GitHub (Feb 16, 2020): This allowed `CSI 3 J` but seems to have forgotten RIS? It least RIS doesn't seem to work for me on the new build mentioned above.
Author
Owner

@studoot commented on GitHub (Feb 16, 2020):

And as far as I can tell, the original bug report (printf "\033c" not clearing scrollback in WSL bash) is still the case with the 0.9 build.

@studoot commented on GitHub (Feb 16, 2020): And as far as I can tell, the original bug report (`printf "\033c"` not clearing scrollback in WSL bash) is still the case with the 0.9 build.
Author
Owner

@Lemmingh commented on GitHub (Feb 17, 2020):

@studoot , Clearing scrollback should be considered as another issue related to ConPTY, I think. Actually, every app running in Windows Terminal is experiencing the problem, whether it's PowerShell, WSL, Cmd, etc.

According to issue #1193, there is difficulty in clearing ConPTY's own buffer. Thus unfortunately, it's impossible to clear scrollback entirely for now.

@Lemmingh commented on GitHub (Feb 17, 2020): @studoot , **Clearing scrollback** should be considered as *another* issue related to [ConPTY](https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/), I think. Actually, *every* app running in Windows Terminal is experiencing the problem, whether it's PowerShell, WSL, Cmd, etc. According to issue #1193, there is difficulty in clearing **ConPTY's own buffer**. Thus unfortunately, it's impossible to clear scrollback *entirely* for now.
Author
Owner

@j4james commented on GitHub (Feb 27, 2020):

@Lemmingh The problem of clearing the scrollback in PowerShell and Cmd is covered by another issue (#3126), because Windows applications don't use VT sequences like RIS and CSI 3J. In that case we need to intercept the Windows API calls that are used to clear the scrollback, and then convert them into equivalent VT escape sequences (that's really the whole point of conpty). In a perfect world, fixing those Windows apps would automatically make RIS work as well, but in practice it's probably not that simple.

@j4james commented on GitHub (Feb 27, 2020): @Lemmingh The problem of clearing the scrollback in PowerShell and Cmd is covered by another issue (#3126), because Windows applications don't use VT sequences like `RIS` and `CSI 3J`. In that case we need to intercept the Windows API calls that are used to clear the scrollback, and then convert them into equivalent VT escape sequences (that's really the whole point of conpty). In a perfect world, fixing those Windows apps would automatically make `RIS` work as well, but in practice it's probably not that simple.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3820