diff options
author | Segev Finer <segev208@gmail.com> | 2022-02-05 22:12:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-05 21:12:47 +0100 |
commit | 0b184c3ccbb9f97029642e139c604615eeb4ac95 (patch) | |
tree | 9ab3a90d7fd33149677503b965bfa20cbdf365e6 | |
parent | aaf4c1712208bb59ade4fee94d22eb1ba6e2999f (diff) |
feat(pwsh): Set ExtraPromptLineCount (#3439)
* feat(pwsh): Set ExtraPromptLineCount
Fixes #3419
* Rename $prompt to $promptText
-rwxr-xr-x | src/init/starship.ps1 | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/init/starship.ps1 b/src/init/starship.ps1 index d756476ee..5dd6f7fc7 100755 --- a/src/init/starship.ps1 +++ b/src/init/starship.ps1 @@ -106,7 +106,13 @@ $null = New-Module starship { $arguments += "--status=$($lastExitCodeForPrompt)" # 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. $global:LASTEXITCODE = $origLastExitCode |