fix: correct hyperlinks for Git Bash

kill it with fire
This commit is contained in:
Jan De Dobbeleer 2024-07-23 20:06:16 +02:00 committed by Jan De Dobbeleer
parent 7563d5f4ad
commit eb1cf548cd
2 changed files with 4 additions and 2 deletions

View file

@ -69,7 +69,7 @@ func TestPrintPWD(t *testing.T) {
Pwd: `C:\Users\user\Documents\GitHub\oh-my-posh`, Pwd: `C:\Users\user\Documents\GitHub\oh-my-posh`,
Config: terminal.OSC99, Config: terminal.OSC99,
Shell: shell.BASH, Shell: shell.BASH,
Expected: "\x1b]9;9;C:\\Users\\user\\Documents\\GitHub\\oh-my-posh\x1b\\", Expected: "\x1b]9;9;C:/Users/user/Documents/GitHub/oh-my-posh\x1b\\",
}, },
} }

View file

@ -163,9 +163,11 @@ func Pwd(pwdType, userName, hostName, pwd string) string {
} }
if strings.HasSuffix(pwd, ":") { if strings.HasSuffix(pwd, ":") {
pwd += "\\" pwd += `/`
} }
pwd = strings.ReplaceAll(pwd, `\`, `/`)
switch pwdType { switch pwdType {
case OSC7: case OSC7:
return fmt.Sprintf(formats.Osc7, hostName, pwd) return fmt.Sprintf(formats.Osc7, hostName, pwd)