feat(pwsh): Set ExtraPromptLineCount (#3439)

* feat(pwsh): Set ExtraPromptLineCount

Fixes #3419

* Rename $prompt to $promptText
This commit is contained in:
Segev Finer 2022-02-05 22:12:47 +02:00 committed by GitHub
parent aaf4c17122
commit 0b184c3ccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -106,7 +106,13 @@ $null = New-Module starship {
$arguments += "--status=$($lastExitCodeForPrompt)" $arguments += "--status=$($lastExitCodeForPrompt)"
# Invoke Starship # Invoke Starship
Invoke-Native -Executable ::STARSHIP:: -Arguments $arguments $promptText = Invoke-Native -Executable ::STARSHIP:: -Arguments $arguments
# Set the number of extra lines in the prompt for PSReadLine prompt redraw.
Set-PSReadLineOption -ExtraPromptLineCount ($promptText.Split("`n").Length - 1)
# Return the prompt
$promptText
# Propagate the original $LASTEXITCODE from before the prompt function was invoked. # Propagate the original $LASTEXITCODE from before the prompt function was invoked.
$global:LASTEXITCODE = $origLastExitCode $global:LASTEXITCODE = $origLastExitCode