fix(bash): do not escape on Windows

resolves #2263
This commit is contained in:
Jan De Dobbeleer 2022-05-13 15:35:33 +02:00 committed by Jan De Dobbeleer
parent 4888514d1c
commit bc9f884e9c

View file

@ -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