fix(pwsh): count prompt lines correctly

resolves #2081
This commit is contained in:
Jan De Dobbeleer 2022-04-16 13:17:14 +02:00 committed by Jan De Dobbeleer
parent 3fcd4c52b1
commit cf6c7b230d

View file

@ -112,7 +112,7 @@ function global:Initialize-ModuleSupport {
$terminalWidth = $Host.UI.RawUI.WindowSize.Width $terminalWidth = $Host.UI.RawUI.WindowSize.Width
$standardOut = @(Start-Utf8Process $omp "print primary --error=$global:OMP_ERRORCODE --pwd=""$cleanPWD"" --pswd=""$cleanPSWD"" --execution-time=$global:OMP_EXECUTIONTIME --stack-count=$stackCount --config=""$Env:POSH_THEME"" --terminal-width=$terminalWidth") $standardOut = @(Start-Utf8Process $omp "print primary --error=$global:OMP_ERRORCODE --pwd=""$cleanPWD"" --pswd=""$cleanPSWD"" --execution-time=$global:OMP_EXECUTIONTIME --stack-count=$stackCount --config=""$Env:POSH_THEME"" --terminal-width=$terminalWidth")
# make sure PSReadLine knows we have a multiline prompt # make sure PSReadLine knows we have a multiline prompt
$extraLines = $standardOut.Count - 1 $extraLines = ($standardOut | Measure-Object -Line).Lines - 1
if ($extraLines -gt 0) { if ($extraLines -gt 0) {
Set-PSReadlineOption -ExtraPromptLineCount $extraLines Set-PSReadlineOption -ExtraPromptLineCount $extraLines
} }