From 45636537243ff0bcafc8103e3b49bdfc12cd3d31 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 25 Feb 2000 15:52:40 +0000 Subject: zsh-workers/9880 --- Completion/Core/_path_files | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Completion/Core') diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index 60a266482..a4ba55760 100644 --- a/Completion/Core/_path_files +++ b/Completion/Core/_path_files @@ -172,9 +172,19 @@ if [[ "$pre[1]" = \~ ]]; then # prefix from the string to complete, set `donepath' to build the correct # paths and make sure that the loop below is run only once with an empty # prefix path by setting `prepaths'. - - linepath="${pre%%/*}/" - realpath=$~linepath + + linepath="${pre[2,-1]%%/*}" + if [[ -z "$linepath" ]]; then + realpath="${HOME%/}/" + elif (( $+userdirs[$linepath] )); then + realpath="${userdirs[$linepath]%/}/" + elif (( $+nameddirs[$linepath] )); then + realpath="${nameddirs[$linepath]%/}/" + else + _message "unknown user \`$linepath'" + return 1 + fi + linepath="~${linepath}/" [[ "$realpath" = "$linepath" ]] && return 1 pre="${pre#*/}" orig="${orig#*/}" -- cgit 1.4.1