-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
- A reopening of Select-String doesn't render VT (ANSI) escape sequences in its for-display output with input from external programs on Windows #18294, Streamed executable output prints Ansi Escaping in Write-* Commandlets #18771, and Problems with enabling Virtual Terminal Mode when streaming program output on conhost #19813, which were inappropriately closed as
Resolution-External. - The problem still exists in v7.4.0, and was introduced in 7.3.0-preview.2, according to @Hermel's findings.
To recap the repro steps: The problem occurs:
- on Windows
- in regular console windows (
conhost.exe), not in Windows Terminal- with the
VirtualTerminalLevelregistry value in keyHKEY_CURRENT_USER\ConsoleNOT manually set to1, i.e. either set to0or - as is the default - with the value not defined.
- with the
- with input from external programs
# From a conhost.exe console window on Windows,
# with the defaults (see note re `VirtualTerminalLevel` above).
cmd /c echo foo | Select-String fSuboptimal workarounds:
- Enclose the external-program call in
(...) - Enable ANSI/VT support in
conhost.execonsole windows system-wide, via the registry:Set-ItemProperty HKCU:\Console VirtualTerminalLevel -Type DWORD 1- The preferable alternative, namely to make PowerShell itself unconditionally enable ANSI/VT support (something that Windows Terminal already does), was declined, even though it would be less drastic than a system-wide setting: Consider implicitly activating VT / ANSI escape-sequence support for native programs in
conhost.execonsole windows on Windows #19101 (comment)
Suspected cause, quoting @SeeminglyScience from #18294 (comment):
I would guess it's related to #16612 but I've looked it over and I can't easily see how. We should be re-enabling VT more often rather than less, so something is a little off for sure. /cc @daxian-dbw
Expected behavior
foowith f inverted, to highlight the matching part of the line.
Actual behavior
←[7mf←[0mooThat is, the VT escape sequence weren't rendered.
Error details
No response
Environment data
PowerShell 7.4.0 on Windows 11 22H2Visuals
No response
Herrmel and eabase
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.