fix(pwsh): disable tooltips for ConstrainedLanguage mode

This commit is contained in:
L. Yeung 2022-09-17 19:41:52 +08:00 committed by Jan De Dobbeleer
parent 7ebfc530fe
commit 348cacc860
4 changed files with 6 additions and 6 deletions

View file

@ -101,7 +101,7 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock {
}
}
if ("::TOOLTIPS::" -eq "true") {
if (("::TOOLTIPS::" -eq "true") -and ($ExecutionContext.SessionState.LanguageMode -ne "ConstrainedLanguage")) {
Set-PSReadLineKeyHandler -Key Spacebar -BriefDescription 'OhMyPoshSpaceKeyHandler' -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::Insert(' ')
$position = $host.UI.RawUI.CursorPosition
@ -112,7 +112,7 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock {
Write-Host $standardOut -NoNewline
$host.UI.RawUI.CursorPosition = $position
# 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(' ')
[Microsoft.PowerShell.PSConsoleReadLine]::Undo()
}
}

View file

@ -8,8 +8,8 @@ import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
:::info
Due to limitations (or not having found a way just yet), this feature only works in `fish`, `zsh`, `powershell` and `cmd` (as of [Clink][clink] v1.2.46+) for
the time being.
Due to limitations (or not having found a way just yet), this feature only works in `fish`, `zsh`, `powershell`
(`ConstrainedLanguage` mode unsupported) and `cmd` (as of [Clink][clink] v1.2.46+) for the time being.
:::
![Tooltip Demo](/img/posh-tooltip.gif)

View file

@ -8,7 +8,7 @@ import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
:::info
This feature only works in `fish`, `zsh`, `powershell` and `cmd` for the time being.
This feature only works in `fish`, `zsh`, `powershell` (`ConstrainedLanguage` mode unsupported) and `cmd` for the time being.
:::
Transient prompt, when enabled, replaces the prompt with a simpler one to allow more screen real estate.

View file

@ -195,7 +195,7 @@ SAVEHIST=10000
setopt appendhistory
```
### Fish: $( ... ) is not supported
### Fish: $(...) is not supported
You should update fish to v3.4.0 or higher. Fish supports `$(...)` and `"$(...)"` since v3.4.0, as described in its [changelog][fish-changelog].