mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
fix(pwsh): ignore remove when in constrained language mode
This commit is contained in:
parent
4056729e8e
commit
8d9fe9d3c8
|
@ -354,12 +354,14 @@ Example:
|
|||
function Enable-PoshLineError {}
|
||||
|
||||
# perform cleanup on removal so a new initialization in current session works
|
||||
$ExecutionContext.SessionState.Module.OnRemove += {
|
||||
if ((Get-PSReadLineKeyHandler -Key Spacebar).Function -eq 'OhMyPoshSpaceKeyHandler') {
|
||||
Remove-PSReadLineKeyHandler -Key Spacebar
|
||||
}
|
||||
if ((Get-PSReadLineKeyHandler -Key Enter).Function -eq 'OhMyPoshEnterKeyHandler') {
|
||||
Set-PSReadLineKeyHandler -Key Enter -Function AcceptLine
|
||||
if ($ExecutionContext.SessionState.LanguageMode -ne "ConstrainedLanguage") {
|
||||
$ExecutionContext.SessionState.Module.OnRemove += {
|
||||
if ((Get-PSReadLineKeyHandler -Key Spacebar).Function -eq 'OhMyPoshSpaceKeyHandler') {
|
||||
Remove-PSReadLineKeyHandler -Key Spacebar
|
||||
}
|
||||
if ((Get-PSReadLineKeyHandler -Key Enter).Function -eq 'OhMyPoshEnterKeyHandler') {
|
||||
Set-PSReadLineKeyHandler -Key Enter -Function AcceptLine
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue