Fix ConciseView to split PositionMessage using [Environment]::NewLine (#12010)

This commit is contained in:
Dongbo Wang 2020-03-04 13:03:08 -08:00 committed by GitHub
parent 819585cd12
commit 348ca85947
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1100,8 +1100,7 @@ namespace System.Management.Automation.Runspaces
$offsetInLine = 0 $offsetInLine = 0
} }
else { else {
# use newline char instead of $newline because that is what is in the message $positionMessage = $myinv.PositionMessage.Split($newline)
$positionMessage = $myinv.PositionMessage.Split(""`n"")
$line = $positionMessage[1].Substring(1) # skip the '+' at the start $line = $positionMessage[1].Substring(1) # skip the '+' at the start
$highlightLine = $positionMessage[$positionMessage.Count - 1].Substring(1) $highlightLine = $positionMessage[$positionMessage.Count - 1].Substring(1)
$offsetLength = $highlightLine.Trim().Length $offsetLength = $highlightLine.Trim().Length