summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSegev Finer <segev208@gmail.com>2022-02-05 22:12:47 +0200
committerGitHub <noreply@github.com>2022-02-05 21:12:47 +0100
commit0b184c3ccbb9f97029642e139c604615eeb4ac95 (patch)
tree9ab3a90d7fd33149677503b965bfa20cbdf365e6
parentaaf4c1712208bb59ade4fee94d22eb1ba6e2999f (diff)
feat(pwsh): Set ExtraPromptLineCount (#3439)
* feat(pwsh): Set ExtraPromptLineCount Fixes #3419 * Rename $prompt to $promptText
-rwxr-xr-xsrc/init/starship.ps18
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