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..038ba30f9c9 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs @@ -1097,13 +1097,16 @@ function Get-ConciseViewPositionMessage { $offsetInLine = $myinv.OffsetInLine - 1 } + if (-not $line.EndsWith(""`n"")) { + $line += $newline + } # don't color the whole line red if ($offsetLength -lt $line.Length - 1) { $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}^ ""