From 348cacc86056b751261e88ecb019d0a300ee207d Mon Sep 17 00:00:00 2001 From: "L. Yeung" Date: Sat, 17 Sep 2022 19:41:52 +0800 Subject: [PATCH] fix(pwsh): disable tooltips for `ConstrainedLanguage` mode --- src/shell/scripts/omp.ps1 | 4 ++-- website/docs/configuration/tooltips.mdx | 4 ++-- website/docs/configuration/transient.mdx | 2 +- website/docs/faq.mdx | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/shell/scripts/omp.ps1 b/src/shell/scripts/omp.ps1 index 622c7d2c..fdaa0139 100644 --- a/src/shell/scripts/omp.ps1 +++ b/src/shell/scripts/omp.ps1 @@ -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() } } diff --git a/website/docs/configuration/tooltips.mdx b/website/docs/configuration/tooltips.mdx index 4ab64e24..2d2fa0b3 100644 --- a/website/docs/configuration/tooltips.mdx +++ b/website/docs/configuration/tooltips.mdx @@ -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) diff --git a/website/docs/configuration/transient.mdx b/website/docs/configuration/transient.mdx index ef5719cc..5f905c80 100644 --- a/website/docs/configuration/transient.mdx +++ b/website/docs/configuration/transient.mdx @@ -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. diff --git a/website/docs/faq.mdx b/website/docs/faq.mdx index d3f081c8..ae1677a6 100644 --- a/website/docs/faq.mdx +++ b/website/docs/faq.mdx @@ -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].