From 7368c6541e5f35d51174de7ab5a5893b26894ece Mon Sep 17 00:00:00 2001 From: "L. Yeung" Date: Sat, 22 Apr 2023 02:02:46 +0800 Subject: [PATCH] fix(pwsh): remove cached tip command when rendering a new prompt --- src/shell/scripts/omp.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shell/scripts/omp.ps1 b/src/shell/scripts/omp.ps1 index 7d8c99ba..4c203b18 100644 --- a/src/shell/scripts/omp.ps1 +++ b/src/shell/scripts/omp.ps1 @@ -127,7 +127,7 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock { $cleanPSWD = Get-CleanPSWD $command = $null [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$command, [ref]$null) - $command = $command.Trim().Split(" ", 2) | Select-Object -First 1 + $command = $command.TrimStart().Split(" ", 2) | Select-Object -First 1 if ($command -eq $script:ToolTipCommand) { return } @@ -397,6 +397,9 @@ Example: # remove any posh-git status $env:POSH_GIT_STATUS = $null + # remove cached tip command + $script:ToolTipCommand = "" + # restore the orignal last exit code $global:LASTEXITCODE = $script:OriginalLastExitCode }