mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-13 12:17:26 -08:00
fix(fish): escape hyperlinks correctly
This commit is contained in:
parent
8ec153a2dd
commit
32879eb990
|
@ -64,7 +64,7 @@ func (a *Ansi) Init(shellName string) {
|
|||
a.colorTransparent = "%%{\x1b[%s;49m\x1b[7m%%}%s%%{\x1b[0m%%}"
|
||||
a.escapeLeft = "%{"
|
||||
a.escapeRight = "%}"
|
||||
a.hyperlink = "%%{\x1b]8;;%s\x1b\\%%}%s%%{\x1b]8;;\x1b\\%%}"
|
||||
a.hyperlink = "%%{\x1b]8;;%s\x1b\\\\%%}%s%%{\x1b]8;;\x1b\\\\%%}"
|
||||
a.osc99 = "%%{\x1b]9;9;\"%s\"\x1b\\%%}"
|
||||
a.bold = "%%{\x1b[1m%%}%s%%{\x1b[22m%%}"
|
||||
a.italic = "%%{\x1b[3m%%}%s%%{\x1b[23m%%}"
|
||||
|
@ -129,6 +129,9 @@ func (a *Ansi) Init(shellName string) {
|
|||
a.dimmed = "\x1b[2m%s\x1b[22m"
|
||||
a.strikethrough = "\x1b[9m%s\x1b[29m"
|
||||
}
|
||||
if shellName == shell.FISH {
|
||||
a.hyperlink = "\x1b]8;;%s\x1b\\\\%s\x1b]8;;\x1b\\\\"
|
||||
}
|
||||
// common replacement for all shells
|
||||
a.shellReservedKeywords = append(a.shellReservedKeywords, shellKeyWordReplacement{"`", "'"})
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ func TestGenerateHyperlinkWithUrl(t *testing.T) {
|
|||
ShellName string
|
||||
Expected string
|
||||
}{
|
||||
{Text: "[google](http://www.google.be)", ShellName: shell.ZSH, Expected: "%{\x1b]8;;http://www.google.be\x1b\\%}google%{\x1b]8;;\x1b\\%}"},
|
||||
{Text: "[google](http://www.google.be)", ShellName: shell.ZSH, Expected: "%{\x1b]8;;http://www.google.be\x1b\\\\%}google%{\x1b]8;;\x1b\\\\%}"},
|
||||
{Text: "[google](http://www.google.be)", ShellName: shell.PWSH, Expected: "\x1b]8;;http://www.google.be\x1b\\google\x1b]8;;\x1b\\"},
|
||||
{Text: "[google](http://www.google.be)", ShellName: shell.BASH, Expected: "\\[\x1b]8;;http://www.google.be\x1b\\\\\\]google\\[\x1b]8;;\x1b\\\\\\]"},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue