From bc9f884e9c62aa4c6cfe4b55393bd34dc8110f02 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Fri, 13 May 2022 15:35:33 +0200 Subject: [PATCH] fix(bash): do not escape on Windows resolves #2263 --- src/engine/segment.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/segment.go b/src/engine/segment.go index c8e12317..02f3f5d2 100644 --- a/src/engine/segment.go +++ b/src/engine/segment.go @@ -356,7 +356,8 @@ func (segment *Segment) SetText() { // see https://github.com/JanDeDobbeleer/oh-my-posh/discussions/2255 // this can't happen where we do regular text replacement in ansi.go // as that would also replace valid \[\] sequences and break the prompt - if segment.env.Shell() == shell.BASH { + // except for git bash on Windows + if segment.env.Shell() == shell.BASH && segment.env.Platform() != environment.WindowsPlatform { segment.text = strings.ReplaceAll(segment.text, `\`, `\\`) } segment.Enabled = len(strings.ReplaceAll(segment.text, " ", "")) > 0