Skip to content

Select-String emphasis improperly highlights spaces in matching lines as wide or wider than [console]::WindowWidth #25833

@mrenton999

Description

@mrenton999

Prerequisites

Steps to reproduce

Using PowerShell in Windows Terminal
PS> driverquery.exe /V > driverqueryV.txt # generate a searchable file
PS> sls mouse .\driverqueryV.txt

Expected behavior

Only the matching strings are highlighted in the listed matching lines

Actual behavior

The matching strings are highlighted (sometimes with trailing space), but so are occurrences of multiple spaces in the lines

Error details

N/A

Environment data

PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, 5.0, 5.1, 6.0, 7.0}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

As seen in this window snip

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    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