From 6aa2261d52de6d3ecf2211aa5b3a465b3b1c7c45 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Wed, 18 Apr 2001 16:02:50 +0000 Subject: Tilde-path completion tweak. --- Completion/Unix/Type/_path_files | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index bc784426c..ffaf0d77f 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -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 -- cgit 1.4.1