mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(pwsh): get stack count correctly
This commit is contained in:
parent
a51716d5ac
commit
eb11aa9081
|
@ -2,6 +2,11 @@
|
||||||
if ($null -ne (Get-Module -Name "oh-my-posh-core")) {
|
if ($null -ne (Get-Module -Name "oh-my-posh-core")) {
|
||||||
Remove-Module -Name "oh-my-posh-core" -Force
|
Remove-Module -Name "oh-my-posh-core" -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-PoshStackCount {
|
||||||
|
return (Get-Location -Stack).Count
|
||||||
|
}
|
||||||
|
|
||||||
New-Module -Name "oh-my-posh-core" -ScriptBlock {
|
New-Module -Name "oh-my-posh-core" -ScriptBlock {
|
||||||
$script:ErrorCode = 0
|
$script:ErrorCode = 0
|
||||||
$script:OMPExecutable = '::OMP::'
|
$script:OMPExecutable = '::OMP::'
|
||||||
|
@ -272,13 +277,7 @@ Example:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$stackCount = (Get-Location -Stack).Count
|
$stackCount = Get-PoshStackCount
|
||||||
try {
|
|
||||||
if (Test-Path Variable:/global:OMP_GLOBAL_SESSIONSTATE) {
|
|
||||||
$stackCount = $global:OMP_GLOBAL_SESSIONSTATE.Path.LocationStack('').Count
|
|
||||||
}
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
Set-PoshContext
|
Set-PoshContext
|
||||||
$terminalWidth = $Host.UI.RawUI.WindowSize.Width
|
$terminalWidth = $Host.UI.RawUI.WindowSize.Width
|
||||||
# set a sane default when the value can't be retrieved
|
# set a sane default when the value can't be retrieved
|
||||||
|
|
Loading…
Reference in a new issue