mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
fix(bash): replace all single occurances of \
This commit is contained in:
parent
6a7f03eb5b
commit
8c9b6358b5
|
@ -7,6 +7,7 @@ import (
|
|||
"oh-my-posh/environment"
|
||||
"oh-my-posh/properties"
|
||||
"oh-my-posh/segments"
|
||||
"oh-my-posh/shell"
|
||||
"oh-my-posh/template"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
|
@ -352,5 +353,11 @@ func (segment *Segment) SetText() {
|
|||
return
|
||||
}
|
||||
segment.text = segment.string()
|
||||
// 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 {
|
||||
segment.text = strings.ReplaceAll(segment.text, `\`, `\\`)
|
||||
}
|
||||
segment.Enabled = len(strings.ReplaceAll(segment.text, " ", "")) > 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue