diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | Completion/Unix/Type/_path_files | 23 |
2 files changed, 30 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 55c1d26b8..11ad17f6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-02-24 Peter Stephenson <pws@csr.com> + + * 18230: Completion/Unix/Type/_path_files: If globbing failed + to match a path entry, test to see if [[ -e <file> ]] worked + anyway. This supports smart filing systems (cygdrive, ClearCase + dynamic views) and may work for automounted directories (so + commented out the other hack to see). + 2003-02-23 Peter Stephenson <pws@pwstephenson.fsnet.co.uk> * 18278: Functions/TCP/tcp_output, Functions/TCP/tcp_spam, diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index 45308bc93..b4d6e105e 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -324,8 +324,11 @@ for prepath in "$prepaths[@]"; do fi # Force auto-mounting. There might be a better way... + # Commented out in the hope that `pws non-canonical hack' + # down below does this for us. Can be uncommented if it + # doesn't. - : ${^tmp1}/${PREFIX}${SUFFIX}/.(/) + # : ${^tmp1}/${PREFIX}${SUFFIX}/.(/) # Get the matching files by globbing. @@ -343,6 +346,24 @@ for prepath in "$prepaths[@]"; do if [[ -n "$PREFIX$SUFFIX" ]]; then # See which of them match what's on the line. + # pws non-canonical hack which seems to work so far... + # if we didn't match by globbing, check that there is + # something to match by explicit name. This is for + # `clever' filing systems where names pop into existence + # when referenced. + if (( ! $#tmp1 )); then + for tmp3 in "$tmp2[@]"; do + if [[ -n $tmp3 && $tmp3 != */ ]]; then + tmp3+=/ + fi + if [[ -e "$tmp3${(Q)PREFIX}${(Q)SUFFIX}" ]] then + ## DEBUG + print "added $tmp3${(Q)PREFIX}${(Q)SUFFIX}" >&2 + tmp1+=("$tmp3${(Q)PREFIX}${(Q)SUFFIX}") + fi + done + fi + if (( ! $#tmp1 )); then tmp2=( ${^tmp2}/$PREFIX$SUFFIX ) elif [[ "$tmp1[1]" = */* ]]; then |