about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/_path_files11
1 files changed, 6 insertions, 5 deletions
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 5673e7c4a..7f6f83184 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -5,7 +5,7 @@
 
 local linepath realpath donepath prepath testpath exppath skips skipped
 local tmp1 tmp2 tmp3 tmp4 i orig eorig pre suf tpre tsuf opre osuf cpre
-local pats haspats ignore pfxsfx sopt gopt opt sdirs ignpar
+local pats haspats ignore pfxsfx sopt gopt opt sdirs ignpar cfopt
 local nm=$compstate[nmatches] menu matcher mopts sort match mid
 
 typeset -U prepaths exppaths
@@ -185,6 +185,7 @@ eorig="$orig"
 [[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" ||
    ( -n "$compstate[pattern_match]" &&
      "${orig#\~}" != (|*[^\\])[][*?#~^\|\<\>]* ) ]] && menu=yes
+[[ -n "$_comp_correct" ]] && cfopt=-
 
 # Now let's have a closer look at the string to complete.
 
@@ -222,7 +223,7 @@ if [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
     elif [[ tmp -le $#dirstack ]]; then
       realpath=$dirstack[tmp]/
     else
-      _message 'not directory stack entries'
+      _message 'not enough directory stack entries'
       return 1
     fi
   elif [[ "$linepath" = [-+] ]]; then
@@ -313,11 +314,11 @@ for prepath in "$prepaths[@]"; do
     # Get the matching files by globbing.
 
     if [[ "$tpre$tsuf" = */* ]]; then
-      compfiles -P tmp1 "$skipped" "$_matcher" "$sdirs"
+      compfiles -P$cfopt tmp1 "$skipped" "$_matcher" "$sdirs"
     elif [[ "$sopt" = *[/f]* ]]; then
-      compfiles -p tmp1 "$skipped" "$_matcher" "$sdirs" "$pats"
+      compfiles -p$cfopt tmp1 "$skipped" "$_matcher" "$sdirs" "$pats[@]"
     else
-      compfiles -p tmp1 "$skipped" "$_matcher" '' "$pats"
+      compfiles -p$cfopt tmp1 "$skipped" "$_matcher" '' "$pats[@]"
     fi
     tmp1=( $~tmp1 )