mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
The command prefix should also be in the error color for NormalView (#18555)
This commit is contained in:
+11
-2
@@ -1000,8 +1000,12 @@ namespace System.Management.Automation.Runspaces
|
||||
if (@('NativeCommandErrorMessage','NativeCommandError') -notcontains $_.FullyQualifiedErrorId -and @('CategoryView','ConciseView','DetailedView') -notcontains $ErrorView)
|
||||
{
|
||||
$myinv = $_.InvocationInfo
|
||||
if ($myinv -and $myinv.MyCommand)
|
||||
{
|
||||
$errorColor = ''
|
||||
if ($Host.UI.SupportsVirtualTerminal) {
|
||||
$errorColor = $PSStyle.Formatting.Error
|
||||
}
|
||||
|
||||
$commandPrefix = if ($myinv -and $myinv.MyCommand) {
|
||||
switch -regex ( $myinv.MyCommand.CommandType )
|
||||
{
|
||||
([System.Management.Automation.CommandTypes]::ExternalScript)
|
||||
@@ -1046,6 +1050,11 @@ namespace System.Management.Automation.Runspaces
|
||||
$myinv.InvocationName + ' : '
|
||||
}
|
||||
}
|
||||
|
||||
if ($commandPrefix)
|
||||
{
|
||||
$errorColor + $commandPrefix
|
||||
}
|
||||
")
|
||||
.AddScriptBlockExpressionBinding(@"
|
||||
Set-StrictMode -Off
|
||||
|
||||
Reference in New Issue
Block a user