mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(pwsh): erase a previous tooltip before a new one is rendered
This commit is contained in:
parent
2417960c22
commit
8d8d06d4c8
|
@ -133,7 +133,12 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock {
|
||||||
}
|
}
|
||||||
$script:ToolTipCommand = $command
|
$script:ToolTipCommand = $command
|
||||||
$standardOut = @(Start-Utf8Process $script:OMPExecutable @("print", "tooltip", "--error=$script:ErrorCode", "--shell=$script:ShellName", "--pswd=$cleanPSWD", "--config=$env:POSH_THEME", "--command=$command", "--shell-version=$script:PSVersion"))
|
$standardOut = @(Start-Utf8Process $script:OMPExecutable @("print", "tooltip", "--error=$script:ErrorCode", "--shell=$script:ShellName", "--pswd=$cleanPSWD", "--config=$env:POSH_THEME", "--command=$command", "--shell-version=$script:PSVersion"))
|
||||||
|
if ($standardOut -ne '') {
|
||||||
|
# clear from cursor to the end of the line in case a previous tooltip is cut off and partially preserved,
|
||||||
|
# if the new one is shorter
|
||||||
|
Write-Host "`e[K" -NoNewline
|
||||||
Write-Host $standardOut -NoNewline
|
Write-Host $standardOut -NoNewline
|
||||||
|
}
|
||||||
$host.UI.RawUI.CursorPosition = $position
|
$host.UI.RawUI.CursorPosition = $position
|
||||||
# we need this workaround to prevent the text after cursor from disappearing when the tooltip is rendered
|
# we need this workaround to prevent the text after cursor from disappearing when the tooltip is rendered
|
||||||
[Microsoft.PowerShell.PSConsoleReadLine]::Insert(' ')
|
[Microsoft.PowerShell.PSConsoleReadLine]::Insert(' ')
|
||||||
|
|
Loading…
Reference in a new issue