posh-git
posh-git copied to clipboard
Setting BranchAheadStatusSymbol results in spurious `e[0m
System Details
- posh-git version/path: 1.1.0 ~\Documents\PowerShell\Modules\posh-git\1.1.0
- PowerShell version: 7.2.4
- git version 2.27.0.windows.1
- OS: Microsoft Windows NT 10.0.22621.0
Issue Description
When I set $GitPromptSettings.BranchAheadStatusSymbol, a spurious `e[0m is added to the end:
C:\Users\roger> $GitPromptSettings
...
BranchAheadStatusSymbol : Text: "↑", ANSI: "`e[92m↑`e[39m"
...
C:\Users\roger> $GitPromptSettings.BranchAheadStatusSymbol = "`e[92m↑`e[39m"
C:\Users\roger> $GitPromptSettings
...
BranchAheadStatusSymbol : Text: "↑", ANSI: "`e[92m↑`e[39m`e[0m"
...
Any idea where this is coming from? ~~It doesn't happen when setting (e.g.) BeforeStatus
.~~ (it does)
I see the same behavior, but it's not immediately obvious why. @rkeithhill may have an idea?
I had to work around it with the following:
# Work around the fact that PoshGitTextSpan isn't accessible.
$pgts = $GitPromptSettings.BeforeStatus.GetType()
$GitPromptSettings.BeforeStatus = $pgts::new('[', 0xEEEEEC)