You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Powershell clear doesn't reset Line rendition attribute while clearing the screen #21176
Press enter to fill terminal with some lines of text.
Clear screen with Powershell clear:
PS> clear
Expected behavior
After Step 3, the screen is cleared and newly entered lines are rendered normally.
Actual behavior
After Step 3, the screen is cleared and but the newly entered lines are rendered with its previous line rendition.
Error details
No response
Environment data
Name Value
---------
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
The Clear-Host function is different on Windows vs non-Windows already. On Windows, it uses the RawUI APIs and based on a comment in the code seems necessary for WinRM based remoting to some Windows systems that are headless. Not sure if it's relevant anymore, otherwise switching to a universal VT escape sequence makes sense to me.
Activity
237dmitry commentedon Feb 2, 2024
This is old problem with BufferHeight. Workaround:
Only for terminals with non-dynamic buffer height (conhost). In WT this does not work.
tusharsnx commentedon Feb 2, 2024
237dmitry How is the workaround better than using the VT seq
"`e[3;J`e[H`e[J"?237dmitry commentedon Feb 2, 2024
I haven't tried it. At the moment I can’t anymore, not all terminals understand
#3 #4Linux /usr/bin/clear outputs:
tusharsnx commentedon Feb 2, 2024
"`e[H`e[2J`e[3J"works too 👍These sequences are more robust than the current Console APIs based screen clearing (Ex1 Vs. Ex 2 & 3), and
clearshould use virtual terminal sequence based approach.SteveL-MSFT commentedon Feb 5, 2024
The
Clear-Hostfunction is different on Windows vs non-Windows already. On Windows, it uses the RawUI APIs and based on a comment in the code seems necessary for WinRM based remoting to some Windows systems that are headless. Not sure if it's relevant anymore, otherwise switching to a universal VT escape sequence makes sense to me.