Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/util/shellutil/shellintegration/bash_bashrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/shellutil/shellintegration/fish_wavefish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions pkg/util/shellutil/shellintegration/pwsh_wavepwsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions pkg/util/shellutil/shellintegration/zsh_zshrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ _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
}

_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() {
Expand Down
Loading