T05: fish search path, PowerShell policy and load failure, encoded OSC 7 paths, kept exit status, install read errors
This commit is contained in:
6 files changed
+230
-110
No files matched your search
@@ -13,6 +13,16 @@ else
|
||||
[ -r ~/.bashrc ] && builtin source ~/.bashrc
|
||||
fi
|
||||
_ely_prompt() {
|
||||
builtin printf '\e]7;file://%s\a\e]2;%s\a' "${PWD//\%/%25}" "${PWD##*/}"
|
||||
builtin local ret=$? LC_ALL=C char url= i title
|
||||
for (( i = 0; i < ${#PWD}; i++ )); do
|
||||
char=${PWD:i:1}
|
||||
case $char in
|
||||
[[:cntrl:]]|%) builtin printf -v char '%%%02X' "'$char" ;;
|
||||
esac
|
||||
url+=$char
|
||||
done
|
||||
title=${PWD##*/}
|
||||
builtin printf '\e]7;file://%s\a\e]2;%s\a' "$url" "${title//[[:cntrl:]]/}"
|
||||
builtin return $ret
|
||||
}
|
||||
PROMPT_COMMAND="_ely_prompt${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
|
||||
@@ -7,6 +7,6 @@ end
|
||||
set -e ELY_FISH_XDG_DATA_DIRS
|
||||
if status is-interactive
|
||||
function _ely_prompt --on-event fish_prompt
|
||||
printf '\e]7;file://%s\a' (string replace -a % %25 -- $PWD)
|
||||
printf '\e]7;file://%s\a' (string escape --style=url -- $PWD)
|
||||
end
|
||||
end
|
||||
@@ -1,13 +1,15 @@
|
||||
# ELYTerminal: wrap the prompt to report folder and title.
|
||||
$global:ElyPrompt = $function:prompt
|
||||
function global:prompt {
|
||||
$text = & $global:ElyPrompt
|
||||
$folder = $executionContext.SessionState.Path.CurrentLocation
|
||||
if ($folder.Provider.Name -eq 'FileSystem') {
|
||||
$path = $folder.ProviderPath.Replace('\', '/').Replace('%', '%25')
|
||||
$parts = $folder.ProviderPath.Replace('\', '/') -split '/'
|
||||
$path = ($parts | ForEach-Object { [Uri]::EscapeDataString($_) }) -join '/'
|
||||
if (-not $path.StartsWith('/')) { $path = "/$path" }
|
||||
$leaf = Split-Path -Leaf $folder.ProviderPath
|
||||
$leaf = (Split-Path -Leaf $folder.ProviderPath) -replace '\p{Cc}', ''
|
||||
$esc, $bel = [char]27, [char]7
|
||||
[Console]::Write("$esc]7;file://$path$bel$esc]2;$leaf$bel")
|
||||
}
|
||||
& $global:ElyPrompt
|
||||
$text
|
||||
}
|
||||
@@ -8,7 +8,15 @@ fi
|
||||
[[ -r "${ZDOTDIR:-$HOME}/.zshenv" ]] && builtin source "${ZDOTDIR:-$HOME}/.zshenv"
|
||||
if [[ -o interactive ]]; then
|
||||
_ely_precmd() {
|
||||
builtin printf '\e]7;file://%s\a\e]2;%s\a' "${PWD//\%/%25}" "${${PWD:t}:-/}"
|
||||
builtin local ret=$? LC_ALL=C char url=
|
||||
for char in ${(s::)PWD}; do
|
||||
case $char in
|
||||
[[:cntrl:]]|%) builtin printf -v char '%%%02X' "'$char" ;;
|
||||
esac
|
||||
url+=$char
|
||||
done
|
||||
builtin printf '\e]7;file://%s\a\e]2;%s\a' "$url" "${${${PWD:t}:-/}//[[:cntrl:]]/}"
|
||||
builtin return ret
|
||||
}
|
||||
_ely_preexec() {
|
||||
builtin printf '\e]2;%s\a' "${1//[[:cntrl:]]/}"
|
||||
|
||||
Reference in new issue
Block a user