Skip to content

Commit 8b246d7

Browse files
authored
fix osc7 encoding for zsh (bad regex substitutions) (#2578)
1 parent a28d1a1 commit 8b246d7

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

pkg/util/shellutil/shellintegration/bash_bashrc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ _waveterm_si_urlencode() {
7575
_waveterm_si_osc7() {
7676
_waveterm_si_blocked && return
7777
local encoded_pwd=$(_waveterm_si_urlencode "$PWD")
78-
printf '\033]7;file://%s%s\007' "$HOSTNAME" "$encoded_pwd"
78+
printf '\033]7;file://localhost%s\007' "$encoded_pwd"
7979
}
8080

8181
_waveterm_si_precmd() {

pkg/util/shellutil/shellintegration/fish_wavefish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function _waveterm_si_osc7
2121
_waveterm_si_blocked; and return
2222
# Use fish-native URL encoding
2323
set -l encoded_pwd (string escape --style=url -- "$PWD")
24-
printf '\033]7;file://%s%s\007' $hostname $encoded_pwd
24+
printf '\033]7;file://localhost%s\007' $encoded_pwd
2525
end
2626

2727
function _waveterm_si_prompt --on-event fish_prompt

pkg/util/shellutil/shellintegration/pwsh_wavepwsh.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,11 @@ function Global:_waveterm_si_blocked {
2727
function Global:_waveterm_si_osc7 {
2828
if (_waveterm_si_blocked) { return }
2929

30-
# Get hostname (allow empty for file:/// format)
31-
$hostname = $env:COMPUTERNAME
32-
if (-not $hostname) {
33-
$hostname = $env:HOSTNAME
34-
}
35-
3630
# Percent-encode the raw path as-is (handles UNC, drive letters, etc.)
3731
$encoded_pwd = [System.Uri]::EscapeDataString($PWD.Path)
3832

3933
# OSC 7 - current directory
40-
Write-Host -NoNewline "`e]7;file://$hostname/$encoded_pwd`a"
34+
Write-Host -NoNewline "`e]7;file://localhost/$encoded_pwd`a"
4135
}
4236

4337
function Global:_waveterm_si_prompt {

pkg/util/shellutil/shellintegration/zsh_zshrc.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ _waveterm_si_urlencode() {
3131
else
3232
local s="$1"
3333
# Escape % first
34-
s=${s//%/%25}
34+
s=${s//\%/%25}
3535
# Common reserved characters in file paths
36-
s=${s// /%20}
37-
s=${s//#/%23}
36+
s=${s//\ /%20}
37+
s=${s//\#/%23}
3838
s=${s//\?/%3F}
39-
s=${s//&/%26}
40-
s=${s//;/%3B}
41-
s=${s//+/%2B}
39+
s=${s//\&/%26}
40+
s=${s//\;/%3B}
41+
s=${s//\+/%2B}
4242
printf '%s' "$s"
4343
fi
4444
}
4545

4646
_waveterm_si_osc7() {
4747
_waveterm_si_blocked && return
4848
local encoded_pwd=$(_waveterm_si_urlencode "$PWD")
49-
printf '\033]7;file://%s%s\007' "$HOST" "$encoded_pwd" # OSC 7 - current directory
49+
printf '\033]7;file://localhost%s\007' "$encoded_pwd" # OSC 7 - current directory
5050
}
5151

5252
_waveterm_si_precmd() {

0 commit comments

Comments
 (0)