Skip to content

Commit

Permalink
fix(osc99): append \ when inside a root directory
Browse files Browse the repository at this point in the history
resolves #724
  • Loading branch information
JanDeDobbeleer committed May 20, 2021
1 parent 9999260 commit 7a85ee3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ansi.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (a *ansiUtils) init(shell string) {
a.escapeLeft = "%{"
a.escapeRight = "%}"
a.hyperlink = "%%{\x1b]8;;%s\x1b\\%%}%s%%{\x1b]8;;\x1b\\%%}"
a.osc99 = "%%{\x1b]9;9;%s\x1b\\%%}"
a.osc99 = "%%{\x1b]9;9;\"%s\"\x1b\\%%}"
a.bold = "%%{\x1b[1m%%}%s%%{\x1b[22m%%}"
a.italic = "%%{\x1b[3m%%}%s%%{\x1b[23m%%}"
a.underline = "%%{\x1b[4m%%}%s%%{\x1b[24m%%}"
Expand All @@ -70,7 +70,7 @@ func (a *ansiUtils) init(shell string) {
a.escapeLeft = "\\["
a.escapeRight = "\\]"
a.hyperlink = "\\[\x1b]8;;%s\x1b\\\\\\]%s\\[\x1b]8;;\x1b\\\\\\]"
a.osc99 = "\\[\x1b]9;9;%s\x1b\\\\\\]"
a.osc99 = "\\[\x1b]9;9;\"%s\"\x1b\\\\\\]"
a.bold = "\\[\x1b[1m\\]%s\\[\x1b[22m\\]"
a.italic = "\\[\x1b[3m\\]%s\\[\x1b[23m\\]"
a.underline = "\\[\x1b[4m\\]%s\\[\x1b[24m\\]"
Expand All @@ -90,7 +90,7 @@ func (a *ansiUtils) init(shell string) {
a.escapeLeft = ""
a.escapeRight = ""
a.hyperlink = "\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\"
a.osc99 = "\x1b]9;9;%s\x1b\\"
a.osc99 = "\x1b]9;9;\"%s\"\x1b\\"
a.bold = "\x1b[1m%s\x1b[22m"
a.italic = "\x1b[3m%s\x1b[23m"
a.underline = "\x1b[4m%s\x1b[24m"
Expand Down Expand Up @@ -169,5 +169,8 @@ func (a *ansiUtils) changeLine(numberOfLines int) string {
}

func (a *ansiUtils) consolePwd(pwd string) string {
if strings.HasSuffix(pwd, ":") {
pwd += "\\"
}
return fmt.Sprintf(a.osc99, pwd)
}

0 comments on commit 7a85ee3

Please sign in to comment.