Repository: JanDeDobbeleer/oh-my-posh
Pull request #2589 (2022-07-29 06:41:39)

fix pwd
### Prerequisites

- [x] I have read and understood the [contributing guide][CONTRIBUTING.md]
- [x] The commit message follows the [conventional commits][cc] guidelines
- [x] Tests for the changes have been added (for bug fixes/features)
- [x] Docs have been added/updated (for bug fixes/features)

### Description

- fix(ansi): correct osc7 format
- chore: build with go 1.18.4


<!---

Tips:

If you're not comfortable with working with Git, we're working a guide (https://ohmyposh.dev/docs/contributing_git) to help you out.
Oh My Posh advises GitKraken (https://www.gitkraken.com/invite/nQmDPR9D) as your preferred cross platform Git GUI power tool.

-->

[CONTRIBUTING.md]: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/CONTRIBUTING.md
[cc]: https://www.conventionalcommits.org/en/v1.0.0/#summary



Patch:
diff --git a/.github/workflows/composite/bootstrap-go/action.yml b/.github/workflows/composite/bootstrap-go/action.yml
index 4af12748..3a76cb87 100644
--- a/.github/workflows/composite/bootstrap-go/action.yml
+++ b/.github/workflows/composite/bootstrap-go/action.yml
@@ -10,10 +10,10 @@ runs:
     - name: Install Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18.1
+        go-version: 1.18.4
     - name: Override Go ♻️
       shell: pwsh
       run: |
         New-Item -Path ./bin -ItemType Directory
-        Invoke-WebRequest 'https://github.com/jandedobbeleer/go/releases/download/1.18.1/go' -OutFile "$env:GOROOT/bin/go"
+        Invoke-WebRequest 'https://github.com/jandedobbeleer/go/releases/download/1.18.4/go' -OutFile "$env:GOROOT/bin/go"
         chmod a+x "$env:GOROOT/bin/go" 2>&1
diff --git a/src/color/ansi.go b/src/color/ansi.go
index 60ee21d9..932ac132 100644
--- a/src/color/ansi.go
+++ b/src/color/ansi.go
@@ -67,7 +67,7 @@ func (a *Ansi) Init(shellName string) {
 		a.hyperlink = "%%{\x1b]8;;%s\x1b\\%%}%s%%{\x1b]8;;\x1b\\%%}"
 		a.hyperlinkRegex = `(?P<STR>%{\x1b]8;;(.+)\x1b\\%}(?P<TEXT>.+)%{\x1b]8;;\x1b\\%})`
 		a.osc99 = "%%{\x1b]9;9;\"%s\"\x1b\\%%}"
-		a.osc7 = "%%{\x1b]7;file://%s/%s\x1b\\%%}"
+		a.osc7 = "%%{\x1b]7;file:\"//%s/%s\"\x1b\\\\%%}"
 		a.bold = "%%{\x1b[1m%%}%s%%{\x1b[22m%%}"
 		a.italic = "%%{\x1b[3m%%}%s%%{\x1b[23m%%}"
 		a.underline = "%%{\x1b[4m%%}%s%%{\x1b[24m%%}"
@@ -95,7 +95,7 @@ func (a *Ansi) Init(shellName string) {
 		a.hyperlink = "\\[\x1b]8;;%s\x1b\\\\\\]%s\\[\x1b]8;;\x1b\\\\\\]"
 		a.hyperlinkRegex = `(?P<STR>\\\[\x1b\]8;;(.+)\x1b\\\\\\\](?P<TEXT>.+)\\\[\x1b\]8;;\x1b\\\\\\\])`
 		a.osc99 = "\\[\x1b]9;9;\"%s\"\x1b\\\\\\]"
-		a.osc7 = "\\[\x1b]7;file://%s/%s\x1b\\\\]"
+		a.osc7 = "\\[\x1b]7;\"file://%s/%s\"\x1b\\\\\\]"
 		a.bold = "\\[\x1b[1m\\]%s\\[\x1b[22m\\]"
 		a.italic = "\\[\x1b[3m\\]%s\\[\x1b[23m\\]"
 		a.underline = "\\[\x1b[4m\\]%s\\[\x1b[24m\\]"
@@ -123,7 +123,7 @@ func (a *Ansi) Init(shellName string) {
 		a.hyperlink = "\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\"
 		a.hyperlinkRegex = "(?P<STR>\x1b]8;;(.+)\x1b\\\\\\\\?(?P<TEXT>.+)\x1b]8;;\x1b\\\\)"
 		a.osc99 = "\x1b]9;9;\"%s\"\x1b\\"
-		a.osc7 = "\x1b]7;file://%s/%s\x1b\\"
+		a.osc7 = "\x1b]7;\"file://%s/%s\"\x1b\\\\"
 		a.bold = "\x1b[1m%s\x1b[22m"
 		a.italic = "\x1b[3m%s\x1b[23m"
 		a.underline = "\x1b[4m%s\x1b[24m"


Test patch:
diff --git a/src/engine/engine_test.go b/src/engine/engine_test.go
index d3f79892..e079836e 100644
--- a/src/engine/engine_test.go
+++ b/src/engine/engine_test.go
@@ -53,10 +53,10 @@ func TestPrintPWD(t *testing.T) {
 	}{
 		{Case: "Empty PWD"},
 		{Case: "OSC99", PWD: color.OSC99, Expected: "\x1b]9;9;\"pwd\"\x1b\\"},
-		{Case: "OSC7", PWD: color.OSC7, Expected: "\x1b]7;file://host/pwd\x1b\\"},
+		{Case: "OSC7", PWD: color.OSC7, Expected: "\x1b]7;\"file://host/pwd\"\x1b\\\\"},
 		{Case: "Deprecated OSC99", OSC99: true, Expected: "\x1b]9;9;\"pwd\"\x1b\\"},
 		{Case: "Template (empty)", PWD: "{{ if eq .Shell \"pwsh\" }}osc7{{ end }}"},
-		{Case: "Template (non empty)", PWD: "{{ if eq .Shell \"shell\" }}osc7{{ end }}", Expected: "\x1b]7;file://host/pwd\x1b\\"},
+		{Case: "Template (non empty)", PWD: "{{ if eq .Shell \"shell\" }}osc7{{ end }}", Expected: "\x1b]7;\"file://host/pwd\"\x1b\\\\"},
 	}
 
 	for _, tc := range cases {