diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-08-08 10:32:47 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-08-08 10:32:47 +0000 |
commit | 5c90cf1a51b176badb0095a089df132fc5f62746 (patch) | |
tree | d2117774926e1e19959dd0c24f6810a289b050ec /Completion | |
parent | 40e4f4c40b8da652eded74fb3c607c2fb289a10f (diff) | |
download | zsh-5c90cf1a51b176badb0095a089df132fc5f62746.tar.gz zsh-5c90cf1a51b176badb0095a089df132fc5f62746.tar.xz zsh-5c90cf1a51b176badb0095a089df132fc5f62746.zip |
more fixes for completion of special characters (quoting) (12565)
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Core/_expand | 6 | ||||
-rw-r--r-- | Completion/Core/_path_files | 27 |
2 files changed, 26 insertions, 7 deletions
diff --git a/Completion/Core/_expand b/Completion/Core/_expand index bcc357ead..9e7d3d122 100644 --- a/Completion/Core/_expand +++ b/Completion/Core/_expand @@ -63,7 +63,7 @@ if [[ "$force" = *s* ]] || eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \) eval 'exp=( ${${(e)exp//\\[ ]/ }//(#b)([ -\\])/\\$match[1]} )' 2>/dev/null +])/\\$match[1]} )' 2>/dev/null else exp=( ${exp:s/\\\$/\$} ) fi @@ -77,14 +77,14 @@ subd=("$exp[@]") # Now try globbing. [[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob && - eval 'exp=( ${~exp} ); exp=( ${exp//(#b)([][()|*?^#~<>\\])/\\${match[1]}} )' 2>/dev/null + eval 'exp=( ${~exp} ); exp=( ${exp//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )' 2>/dev/null # If we don't have any expansions or only one and that is the same # as the original string, we let other completers run. (( $#exp )) || exp=("$subd[@]") -[[ $#exp -eq 1 && "$exp[1]" = "$word"(|\(N\)) ]] && return 1 +[[ $#exp -eq 1 && "${exp[1]//\\}" = "${word//\\}"(|\(N\)) ]] && return 1 # With subst-globs-only we bail out if there were no glob expansions, # regardless of any substitutions diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index 8bb00bdf9..23d32cc0f 100644 --- a/Completion/Core/_path_files +++ b/Completion/Core/_path_files @@ -421,7 +421,7 @@ for prepath in "$prepaths[@]"; do # There are more components, so skip over the next components and make a # slash be added. - tmp1=( ${tmp1//(#b)([][()|*?^#~<>\\])/\\${match[1]}} ) + tmp1=( ${tmp1//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} ) tmp2="${(M)tpre##((.|..|)/)##}" if [[ -n "$tmp2" ]]; then skipped="/$tmp2" @@ -470,7 +470,14 @@ for prepath in "$prepaths[@]"; do # it as far as possible. tmp2="$testpath" - compquote tmp1 tmp2 + if [[ -n "$linepath" ]]; then + compquote -p tmp2 tmp1 + elif [[ -n "$tmp2" ]]; then + compquote -p tmp1 + compquote tmp2 + else + compquote tmp1 tmp2 + fi if [[ -n $menu || -z "$compstate[insert]" ]] || ! zstyle -t ":completion:${curcontext}:paths" expand suffix; then @@ -544,7 +551,12 @@ for prepath in "$prepaths[@]"; do tmp4="${testpath#${mid}}" tmp3="${mid%/*/}" tmp2="${${mid%/}##*/}" - compquote tmp4 tmp3 tmp2 tmp1 + if [[ -n "$linepath" ]]; then + compquote -p tmp3 + else + compquote tmp3 + fi + compquote tmp4 tmp2 tmp1 for i in "$tmp1[@]"; do compadd -Qf "$mopts[@]" -p "$linepath$tmp3/" -s "/$tmp4$i" \ -W "$prepath$realpath${mid%/*/}/" \ @@ -559,7 +571,14 @@ for prepath in "$prepaths[@]"; do SUFFIX="${osuf}" fi tmp4="$testpath" - compquote tmp4 tmp1 + if [[ -n "$linepath" ]]; then + compquote -p tmp4 tmp1 + elif [[ -n "$tmp4" ]]; then + compquote -p tmp1 + compquote tmp4 + else + compquote tmp4 tmp1 + fi compadd -Qf "$mopts[@]" -p "$linepath$tmp4" -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" -M "r:|/=* r:|=*" -a tmp1 fi |