From 0396066ffbfd1e31f1cc8f51f496e0b0b3d37aa5 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 17 Dec 2019 10:16:00 -0800 Subject: [PATCH 1/3] Remove unnecessary newline in ConciseView --- .../DefaultFormatters/PowerShellCore_format_ps1xml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs index 2237e05f5f7..ae2c603a59e 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs @@ -1103,7 +1103,7 @@ function Get-ConciseViewPositionMessage { $line = $line.Insert($offsetInLine + $offsetLength, $resetColor).Insert($offsetInLine, $accentColor) } - $posmsg += ""${accentColor}${lineWhitespace}${ScriptLineNumber} ${verticalBar} ${resetcolor}${line}`n"" + $posmsg += ""${accentColor}${lineWhitespace}${ScriptLineNumber} ${verticalBar} ${resetcolor}${line}"" $offsetWhitespace = ' ' * $offsetInLine $prefix = ""${accentColor}${headerWhitespace} ${verticalBar} ${errorColor}"" $message = ""${prefix}${offsetWhitespace}^ "" From 207cf08af017c02e6f3f863a2cc7be7e3f742cc1 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 17 Dec 2019 11:59:10 -0800 Subject: [PATCH 2/3] address Ilya's feedback by adding newline if it's missing --- .../DefaultFormatters/PowerShellCore_format_ps1xml.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs index ae2c603a59e..2f3369d8027 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs @@ -1097,6 +1097,9 @@ function Get-ConciseViewPositionMessage { $offsetInLine = $myinv.OffsetInLine - 1 } + if (-not $line.EndsWith(""`n"")) { + $line += ""`n"" + } # don't color the whole line red if ($offsetLength -lt $line.Length - 1) { From 21da362b3ecec7ea3926891a4275f1d019fdc417 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 17 Dec 2019 13:14:09 -0800 Subject: [PATCH 3/3] address nightroman's feedback --- .../DefaultFormatters/PowerShellCore_format_ps1xml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs index 2f3369d8027..038ba30f9c9 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs @@ -1098,7 +1098,7 @@ function Get-ConciseViewPositionMessage { } if (-not $line.EndsWith(""`n"")) { - $line += ""`n"" + $line += $newline } # don't color the whole line red