Skip to content

Formatting doesn't handle the property with ANSI escape sequence string value properly, which leads to color leaking #17157

Description

@thegraffix

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

N/A

Screenshot

Get-PSReadLineOption 1
Get-PSReadLineOption 2

Environment data

PS Version: 5.1.19041.1645
PS HostName: ConsoleHost
PSReadLine Version: 2.2.2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 106
BufferHeight: 3000

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:

  1. Type Get-PSReadlineOption | Format-List *

To resolve:

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions