Skip to content

Commit

Permalink
fix: correct ANSI for path notification
Browse files Browse the repository at this point in the history
relates to #409
  • Loading branch information
JanDeDobbeleer committed Feb 15, 2021
1 parent 860eeb4 commit caf3e2b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ansi_formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ansiFormats struct {
colorTransparent string
escapeLeft string
escapeRight string
hyperlink string
osc8 string
osc99 string
}

Expand All @@ -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\\]"
Expand All @@ -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"
Expand All @@ -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\\"
}
}

Expand All @@ -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)
}

0 comments on commit caf3e2b

Please sign in to comment.