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
Happens on PS 5.1 console and Windows Terminal app (cannot reproduce with the ISE nor PowerShell 7.2.2)
To reproduce:
Type Get-PSReadlineOption | Format-List *
To resolve:
Type Get-PSReadLineOption (without | Format-List *) and color scheme is restored after the property CommandColor is listed on-screen. See bottom screenshot for a better explanation of this.
Expected behavior
Color scheme should remain constant
Actual behavior
Console color scheme now appears like the ListPredictionSelectedColor color scheme
Missing property values (see screenshot)
Clearing the screen/changing console size doesn't resolve the issue.
The text was updated successfully, but these errors were encountered:
This is an issue with the PowerShell formatting. When using Format-List *, the formatting view registered by the PSReadLine module won't be used. Instead, PowerShell formatting will dump every property of the object and display them in a list view.
The problem is that PowerShell formatting doesn't handle ANSI escape codes properly. The color properties are all holding ANSI sequences for color, which should not be simply written to console as regular strings. And doing so will lead to color leaking, which is what is observed in your screenshot. I will transfer this issue to PowerShell repo.
daxian-dbw
changed the title
Unexpected screen colors/behavior/missing property values when doing: Get-PSReadLineOption | Format-List *
Formatting doesn't handle the property with ANSI escape sequence string value properly, which leads to color leaking
Apr 18, 2022
Prerequisites
Exception report
N/A
Screenshot
Environment data
Steps to reproduce
Happens on PS 5.1 console and Windows Terminal app (cannot reproduce with the ISE nor PowerShell 7.2.2)
To reproduce:
Get-PSReadlineOption | Format-List *
To resolve:
Get-PSReadLineOption
(without| Format-List *
) and color scheme is restored after the propertyCommandColor
is listed on-screen. See bottom screenshot for a better explanation of this.Expected behavior
Color scheme should remain constant
Actual behavior
ListPredictionSelectedColor
color schemeThe text was updated successfully, but these errors were encountered: