diff --git a/src/ansi_formats.go b/src/ansi_formats.go index 8bdcd3d63be5..1b0fe40b4ef4 100644 --- a/src/ansi_formats.go +++ b/src/ansi_formats.go @@ -22,7 +22,7 @@ type ansiFormats struct { colorTransparent string escapeLeft string escapeRight string - hyperlink string + osc8 string osc99 string } @@ -43,8 +43,8 @@ func (a *ansiFormats) init(shell string) { a.colorTransparent = "%%{\x1b[%s;49m\x1b[7m%%}%s%%{\x1b[m\x1b[0m%%}" a.escapeLeft = "%{" a.escapeRight = "%}" - a.hyperlink = "%%{\x1b]8;;%s\x1b\\%%}%s%%{\x1b]8;;\x1b\\%%}" - a.osc99 = "%%{\x1b]9;9;%s\x1b7%%}" + a.osc8 = "%%{\x1b]8;;%s\x1b\\%%}%s%%{\x1b]8;;\x1b\\%%}" + a.osc99 = "%%{\033]9;9;%s\033\\%%}" case bash: a.linechange = "\\[\x1b[%d%s\\]" a.left = "\\[\x1b[%dC\\]" @@ -59,8 +59,8 @@ func (a *ansiFormats) init(shell string) { a.colorTransparent = "\\[\x1b[%s;49m\x1b[7m\\]%s\\[\x1b[m\x1b[0m\\]" a.escapeLeft = "\\[" a.escapeRight = "\\]" - a.hyperlink = "\\[\x1b]8;;%s\x1b\\\\\\]%s\\[\x1b]8;;\x1b\\\\\\]" - a.osc99 = "\\[\x1b]9;9;%s\x1b7\\]" + a.osc8 = "\\[\x1b]8;;%s\x1b\\\\\\]%s\\[\x1b]8;;\x1b\\\\\\]" + a.osc99 = "\\[\033]9;9;%s\033\\\\]" default: a.linechange = "\x1b[%d%s" a.left = "\x1b[%dC" @@ -75,8 +75,8 @@ func (a *ansiFormats) init(shell string) { a.colorTransparent = "\x1b[%s;49m\x1b[7m%s\x1b[m\x1b[0m" a.escapeLeft = "" a.escapeRight = "" - a.hyperlink = "\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\" - a.osc99 = "\x1b]9;9;%s\x1b7" + a.osc8 = "\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\" + a.osc99 = "\033]9;9;%s\033\\" } } @@ -102,7 +102,7 @@ func (a *ansiFormats) generateHyperlink(text string) string { return text } // build hyperlink ansi - hyperlink := fmt.Sprintf(a.hyperlink, results["url"], results["name"]) + hyperlink := fmt.Sprintf(a.osc8, results["url"], results["name"]) // replace original text by the new one return strings.Replace(text, results["all"], hyperlink, 1) }