From c1b1eb1bea296aeb6c68abfcc1d6bd4ecab9f76d Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 20 Nov 2025 09:57:14 -0800 Subject: [PATCH 1/3] fix URL escaping in non-omz path --- pkg/util/shellutil/shellintegration/zsh_zshrc.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/util/shellutil/shellintegration/zsh_zshrc.sh b/pkg/util/shellutil/shellintegration/zsh_zshrc.sh index 5df358bb1c..753fef9e18 100644 --- a/pkg/util/shellutil/shellintegration/zsh_zshrc.sh +++ b/pkg/util/shellutil/shellintegration/zsh_zshrc.sh @@ -31,14 +31,14 @@ _waveterm_si_urlencode() { else local s="$1" # Escape % first - s=${s//%/%25} + s=${s//\%/%25} # Common reserved characters in file paths - s=${s// /%20} - s=${s//#/%23} + s=${s//\ /%20} + s=${s//\#/%23} s=${s//\?/%3F} - s=${s//&/%26} - s=${s//;/%3B} - s=${s//+/%2B} + s=${s//\&/%26} + s=${s//\;/%3B} + s=${s//\+/%2B} printf '%s' "$s" fi } From 71d9c83dada7b7a86d9851ed2851b4adec79982d Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 20 Nov 2025 10:02:05 -0800 Subject: [PATCH 2/3] stop sending $HOST (not used and can break the URL). this is safer. --- pkg/util/shellutil/shellintegration/zsh_zshrc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/util/shellutil/shellintegration/zsh_zshrc.sh b/pkg/util/shellutil/shellintegration/zsh_zshrc.sh index 753fef9e18..f24abee181 100644 --- a/pkg/util/shellutil/shellintegration/zsh_zshrc.sh +++ b/pkg/util/shellutil/shellintegration/zsh_zshrc.sh @@ -46,7 +46,7 @@ _waveterm_si_urlencode() { _waveterm_si_osc7() { _waveterm_si_blocked && return local encoded_pwd=$(_waveterm_si_urlencode "$PWD") - printf '\033]7;file://%s%s\007' "$HOST" "$encoded_pwd" # OSC 7 - current directory + printf '\033]7;file://localhost%s\007' "$encoded_pwd" # OSC 7 - current directory } _waveterm_si_precmd() { From 4ee1c1dac6cdbac8b6acd4408cfb8e3edf48ffeb Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 20 Nov 2025 10:30:05 -0800 Subject: [PATCH 3/3] remove hostname from bash, fish, and pwsh osc 7 handlers as well --- pkg/util/shellutil/shellintegration/bash_bashrc.sh | 2 +- pkg/util/shellutil/shellintegration/fish_wavefish.sh | 2 +- pkg/util/shellutil/shellintegration/pwsh_wavepwsh.sh | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/pkg/util/shellutil/shellintegration/bash_bashrc.sh b/pkg/util/shellutil/shellintegration/bash_bashrc.sh index b9c68e6e62..8ec2dc49fb 100644 --- a/pkg/util/shellutil/shellintegration/bash_bashrc.sh +++ b/pkg/util/shellutil/shellintegration/bash_bashrc.sh @@ -75,7 +75,7 @@ _waveterm_si_urlencode() { _waveterm_si_osc7() { _waveterm_si_blocked && return local encoded_pwd=$(_waveterm_si_urlencode "$PWD") - printf '\033]7;file://%s%s\007' "$HOSTNAME" "$encoded_pwd" + printf '\033]7;file://localhost%s\007' "$encoded_pwd" } _waveterm_si_precmd() { diff --git a/pkg/util/shellutil/shellintegration/fish_wavefish.sh b/pkg/util/shellutil/shellintegration/fish_wavefish.sh index d6aa9d5000..f896f015d3 100644 --- a/pkg/util/shellutil/shellintegration/fish_wavefish.sh +++ b/pkg/util/shellutil/shellintegration/fish_wavefish.sh @@ -21,7 +21,7 @@ function _waveterm_si_osc7 _waveterm_si_blocked; and return # Use fish-native URL encoding set -l encoded_pwd (string escape --style=url -- "$PWD") - printf '\033]7;file://%s%s\007' $hostname $encoded_pwd + printf '\033]7;file://localhost%s\007' $encoded_pwd end function _waveterm_si_prompt --on-event fish_prompt diff --git a/pkg/util/shellutil/shellintegration/pwsh_wavepwsh.sh b/pkg/util/shellutil/shellintegration/pwsh_wavepwsh.sh index b24288e305..cc002b57a9 100644 --- a/pkg/util/shellutil/shellintegration/pwsh_wavepwsh.sh +++ b/pkg/util/shellutil/shellintegration/pwsh_wavepwsh.sh @@ -27,17 +27,11 @@ function Global:_waveterm_si_blocked { function Global:_waveterm_si_osc7 { if (_waveterm_si_blocked) { return } - # Get hostname (allow empty for file:/// format) - $hostname = $env:COMPUTERNAME - if (-not $hostname) { - $hostname = $env:HOSTNAME - } - # Percent-encode the raw path as-is (handles UNC, drive letters, etc.) $encoded_pwd = [System.Uri]::EscapeDataString($PWD.Path) # OSC 7 - current directory - Write-Host -NoNewline "`e]7;file://$hostname/$encoded_pwd`a" + Write-Host -NoNewline "`e]7;file://localhost/$encoded_pwd`a" } function Global:_waveterm_si_prompt {