1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-02 00:41:44 +02:00

Tilde-path completion tweak.

This commit is contained in:
Bart Schaefer 2001-04-18 16:02:50 +00:00
parent a924eeba12
commit 6aa2261d52
2 changed files with 13 additions and 7 deletions

@ -1,3 +1,9 @@
2001-04-18 Bart Schaefer <schaefer@zsh.org>
* 14004 (plus typo fix per Sven 14009): Improve completion in the
tail of paths with a leading tilde-component, particularly with
respect to nameddirs.
2001-04-17 Sven Wischnowsky <wischnow@zsh.org>
* 13999: Src/Zle/computil.c: only use the exclusion lists of

@ -190,7 +190,7 @@ eorig="$orig"
# Now let's have a closer look at the string to complete.
if [[ "$pre" = *\$*/* && "$compstate[quote]" != \" ]]; then
if [[ "$pre" = *(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \' ]]; then
# If there is a parameter expansion in the word from the line, we try
# to complete the beast by expanding the prefix and completing anything
@ -207,6 +207,7 @@ if [[ "$pre" = *\$*/* && "$compstate[quote]" != \" ]]; then
donepath=
prepaths=( '' )
elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
# It begins with `~', so remember anything before the first slash to be able
# to report it to the completion code. Also get an expanded version of it
# (in `realpath'), so that we can generate the matches. Then remove that
@ -217,10 +218,6 @@ elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
linepath="${pre[2,-1]%%/*}"
if [[ -z "$linepath" ]]; then
realpath="${HOME%/}/"
elif (( $+userdirs[$linepath] )); then
realpath="${userdirs[$linepath]%/}/"
elif (( $+nameddirs[$linepath] )); then
realpath="${nameddirs[$linepath]%/}/"
elif [[ "$linepath" = ([-+]|)[0-9]## ]]; then
if [[ "$linepath" != [-+]* ]]; then
if [[ -o pushdminus ]]; then
@ -248,8 +245,11 @@ elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
elif [[ "$linepath" = [-+] ]]; then
realpath=${~:-\~$linepath}/
else
_message "unknown user \`$linepath'"
return 1
eval "realpath=~${linepath}/" 2>/dev/null
if [[ -z "$realpath" ]]; then
_message "unknown user \`$linepath'"
return 1
fi
fi
linepath="~${linepath}/"
[[ "$realpath" = "$linepath" ]] && return 1