Skip to content

Commit c86fdb2

Browse files
committed
Add $GitPromptSettings.AnsiConsole
- Enabled if $Host.UI.SupportsVirtualTerminal - Enabled if %ConEmuANSI% is 'ON' - Can be manually set in $PROFILE for other ANSI-capable consoles
1 parent 588033b commit c86fdb2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/GitPrompt.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ $global:GitPromptSettings = [pscustomobject]@{
9797

9898
EnableWindowTitle = 'posh~git ~ '
9999

100+
AnsiConsole = $Host.UI.SupportsVirtualTerminal -or ($Env:ConEmuANSI -eq "ON")
101+
100102
DefaultPromptPrefix = ''
101103
DefaultPromptSuffix = '$(''>'' * ($nestedPromptLevel + 1)) '
102104
DefaultPromptDebugSuffix = ' [DBG]$(''>'' * ($nestedPromptLevel + 1)) '
@@ -128,7 +130,7 @@ if (Get-Module NuGet) {
128130
}
129131

130132
function Write-Prompt($Object, $ForegroundColor, $BackgroundColor = -1) {
131-
if ($Host.UI.SupportsVirtualTerminal) {
133+
if ($GitPromptSettings.AnsiConsole) {
132134
$e = [char]27 + "["
133135
$f = Get-ForegroundVirtualTerminalSequence $ForegroundColor
134136
$b = Get-BackgroundVirtualTerminalSequence $BackgroundColor

0 commit comments

Comments
 (0)