All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
3 # TEMPORARY HACK for #486785
5 # Utility function for in-path completion. This allows `/u/l/b<TAB>'
6 # to complete to `/usr/local/bin'.
8 local linepath realpath donepath prepath testpath exppath skips skipped
9 local tmp1 tmp2 tmp3 tmp4 i orig eorig pre suf tpre tsuf opre osuf cpre
10 local pats haspats ignore pfx pfxsfx sopt gopt opt sdirs ignpar cfopt listsfx
11 local nm=$compstate[nmatches] menu matcher mopts sort mid accex fake
12 local listfiles listopts tmpdisp
13 local -a match mbegin mend
15 typeset -U prepaths exppaths
22 'P:=pfx' 'S:=pfxsfx' 'q=pfxsfx' 'r:=pfxsfx' 'R:=pfxsfx' \
23 'W:=prepaths' 'F:=ignore' 'M+:=matcher' \
24 J+: V+: X+: 1 2 n 'f=tmp1' '/=tmp1' 'g+:-=tmp1'
26 sopt="-${(@j::M)${(@)tmp1#-}#?}"
27 (( $tmp1[(I)-[/g]*] )) && haspats=yes
28 (( $tmp1[(I)-g*] )) && gopt=yes
29 if (( $tmp1[(I)-/] )); then
30 pats="${(@)${(@M)tmp1:#-g*}#-g}"
31 pats=( '*(-/)' ${${(z):-x $pats}[2,-1]} )
33 pats="${(@)${(@M)tmp1:#-g*}#-g}"
34 pats=( ${${(z):-x $pats}[2,-1]} )
36 pats=( "${(@)pats:# #}" )
39 compset -P "$pfx[2]" || pfxsfx=( "$pfx[@]" "$pfxsfx[@]" )
42 if (( $#prepaths )); then
44 if [[ "$tmp1[1]" = '(' ]]; then
45 prepaths=( ${^=tmp1[2,-2]%/}/ )
46 elif [[ "$tmp1[1]" = '/' ]]; then
47 prepaths=( "${tmp1%/}/" )
49 prepaths=( ${(P)^tmp1%/}/ )
50 (( ! $#prepaths )) && prepaths=( ${tmp1%/}/ )
52 (( ! $#prepaths )) && prepaths=( '' )
57 if (( $#ignore )); then
58 if [[ "${ignore[2]}" = \(* ]]; then
59 ignore=( ${=ignore[2][2,-2]} )
61 ignore=( ${(P)ignore[2]} )
65 # If we were given no file selection option, we behave as if we were given
68 if [[ "$sopt" = -(f|) ]]; then
69 if [[ -z "$gopt" ]]; then
77 if (( ! $mopts[(I)-[JVX]] )); then
80 if [[ -z "$gopt" && "$sopt" = -/ ]]; then
81 _description directories expl directory
83 _description files expl file
87 if (( $#matcher )); then
88 matcher[2]="$matcher[2] $expl[1+tmp1]"
90 matcher=(-M "$expl[1+tmp1]")
93 mopts=( "$mopts[@]" "$expl[@]" )
96 # If given no `-F' option, we may want to use $fignore, turned into patterns.
98 [[ -z "$_comp_no_ignore" && $#ignore -eq 0 &&
99 ( -z $gopt || "$pats" = \ #\*\ # ) && -n $FIGNORE ]] &&
100 ignore=( "?*${^fignore[@]}" )
102 if (( $#ignore )); then
103 _comp_ignore=( "$_comp_ignore[@]" "$ignore[@]" )
104 (( $mopts[(I)-F] )) || mopts=( "$mopts[@]" -F _comp_ignore )
107 if [[ $#matcher -eq 0 && -o nocaseglob ]]; then
108 # If globbing is case insensitive and there's no matcher,
109 # do case-insensitive matching.
110 matcher=( -M 'm:{a-zA-Z}={A-Za-z}' )
113 if (( $#matcher )); then
114 # Add the current matcher to the options to compadd.
115 mopts=( "$mopts[@]" "$matcher[@]" )
118 if zstyle -s ":completion:${curcontext}:" file-sort tmp1; then
122 *(time|date|modi)*) sort=om;;
124 *(inode|change)*) sort=oc;;
127 [[ "$tmp1" = *rev* ]] && sort[1]=O
129 if [[ "$sort" = on ]]; then
132 mopts=( "${(@)mopts/#-J/-V}" )
135 for tmp1 in "$pats[@]"; do
136 if [[ "$tmp1" = (#b)(*[^\$])"(#q"(*)")" ]]; then
137 tmp2=( "$tmp2[@]" "${match[1]}(#q${sort}${match[2]})" )
138 elif [[ "$tmp1" = (#b)(*[^\$])(\(\([^\|~]##\)\)) ]]; then
139 tmp2=( "$tmp2[@]" "${match[1]}((${sort}${match[2][3,-1]}" )
140 elif [[ "$tmp1" = (#b)(*[^\$])(\([^\|~]##\)) ]]; then
141 tmp2=( "$tmp2[@]" "${match[1]}(${sort}${match[2][2,-1]}" )
143 tmp2=( "$tmp2[@]" "${tmp1}(${sort})" )
150 # Check if we have to skip over sequences of slashes. The value of $skips
151 # is used below to match the pathname components we always have to accept
154 if zstyle -t ":completion:${curcontext}:paths" squeeze-slashes; then
160 zstyle -s ":completion:${curcontext}:paths" special-dirs sdirs
161 zstyle -t ":completion:${curcontext}:paths" list-suffixes &&
164 [[ "$pats" = ((|*[[:blank:]])\*(|[[:blank:]]*|\([^[:blank:]]##\))|*\([^[:blank:]]#/[^[:blank:]]#\)*) ]] &&
167 zstyle -a ":completion:${curcontext}:paths" accept-exact accex
168 zstyle -a ":completion:${curcontext}:" fake-files fake
170 zstyle -s ":completion:${curcontext}:" ignore-parents ignpar
172 if [[ -n "$compstate[pattern_match]" &&
173 ( ( -z "$SUFFIX" && "$PREFIX" = (|*[^\$])\([^\|\~]##\) ) ||
174 "$SUFFIX" = (|*[^\$])\([^\|\~]##\) ) ]]; then
175 # Copy all glob qualifiers from the line to
176 # the patterns used when generating matches
177 if [[ "$SUFFIX" = *\([^\|\~]##\) ]]; then
178 tmp3="${${(M)SUFFIX%\([^\|\~]##\)}[2,-2]}"
179 SUFFIX="${SUFFIX%\($tmp3\)}"
181 tmp3="${${(M)PREFIX%\([^\|\~]##\)}[2,-2]}"
182 PREFIX="${PREFIX%\($tmp3\)}"
185 for tmp1 in "$pats[@]"; do
186 if [[ "$tmp1" = (#b)(*[^\$])"(#q"(*)")" ]]; then
187 tmp2=( "$tmp2[@]" "${match[1]}(#q${tmp3}${match[2]})" )
188 elif [[ "$tmp1" = (#b)(*[^\$])(\(\([^\|~]##\)\)) ]]; then
189 tmp2=( "$tmp2[@]" "${match[1]}((${tmp3}${match[2][3,-1]}" )
190 elif [[ "$tmp1" = (#b)(*[^\$])(\([^\|~]##\)) ]]; then
191 tmp2=( "$tmp2[@]" "${match[1]}(${tmp3}${match[2][2,-1]}" )
193 tmp2=( "$tmp2[@]" "${tmp1}(${tmp3})" )
199 # We get the prefix and the suffix from the line and save the whole
200 # original string. Then we see if we will do menu completion.
206 orig="${PREFIX}${SUFFIX}"
209 [[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" ||
210 ( -n "$compstate[pattern_match]" &&
211 "${orig#\~}" != (|*[^\\])[][*?#~^\|\<\>]* ) ]] && menu=yes
212 [[ -n "$_comp_correct" ]] && cfopt=-
214 # Now let's have a closer look at the string to complete.
216 if [[ "$pre" = [^][*?#^\|\<\>\\]#(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \' ]]; then
218 # If there is a parameter expansion in the word from the line, we try
219 # to complete the beast by expanding the prefix and completing anything
220 # after the first slash after the parameter expansion.
221 # This fails for things like `f/$foo/b/<TAB>' where the first `f' is
222 # meant as a partial path.
224 linepath="${(M)pre##*\$[^/]##/}"
225 eval 'realpath=${(e)~linepath}' 2>/dev/null
226 [[ -z "$realpath" || "$realpath" = "$linepath" ]] && return 1
227 pre="${pre#${linepath}}"
230 orig="${orig[1,(in:i:)/][1,-2]}"
233 elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
235 # It begins with `~', so remember anything before the first slash to be able
236 # to report it to the completion code. Also get an expanded version of it
237 # (in `realpath'), so that we can generate the matches. Then remove that
238 # prefix from the string to complete, set `donepath' to build the correct
239 # paths and make sure that the loop below is run only once with an empty
240 # prefix path by setting `prepaths'.
242 linepath="${pre[2,-1]%%/*}"
243 if [[ -z "$linepath" ]]; then
244 realpath="${HOME%/}/"
245 elif [[ "$linepath" = ([-+]|)[0-9]## ]]; then
246 if [[ "$linepath" != [-+]* ]]; then
249 if [[ "$linepath" = -* ]]; then
250 tmp1=$(( $#dirstack $linepath ))
254 [[ -o pushdminus ]] && tmp1=$(( $#dirstack - $tmp1 ))
256 if (( ! tmp1 )); then
258 elif [[ tmp1 -le $#dirstack ]]; then
259 realpath=$dirstack[tmp1]/
261 _message 'not enough directory stack entries'
264 elif [[ "$linepath" = [-+] ]]; then
265 realpath=${~:-\~$linepath}/
267 eval "realpath=~${linepath}/" 2>/dev/null
268 if [[ -z "$realpath" ]]; then
269 _message "unknown user \`$linepath'"
273 linepath="~${linepath}/"
274 [[ "$realpath" = "$linepath" ]] && return 1
280 # If the string does not start with a `~' we don't remove a prefix from the
286 if zstyle -s ":completion:${curcontext}:" preserve-prefix tmp1 &&
287 [[ -n "$tmp1" && "$pre" = (#b)(${~tmp1})* ]]; then
289 pre="$pre[${#match[1]}+1,-1]"
290 orig="$orig[${#match[1]}+1,-1]"
294 elif [[ "$pre[1]" = / ]]; then
295 # If it is a absolute path name, we remove the first slash and put it in
296 # `donepath' meaning that we treat it as the path that was already handled.
297 # Also, we don't use the paths from `-W'.
304 # The common case, we just use the string as it is, unless it begins with
305 # `./' or `../' in which case we don't use the paths from `-W'.
307 [[ "$pre" = (.|..)/* ]] && prepaths=( '' )
312 # Now we generate the matches. First we loop over all prefix paths given
313 # with the `-W' option.
315 for prepath in "$prepaths[@]"; do
317 # Get local copies of the prefix, suffix, and the prefix path to use
318 # in the following loop, which walks through the pathname components
319 # in the string from the line.
327 tmp2="${(M)tpre##${~skips}}"
330 tmp1=( "$prepath$realpath$donepath$tmp2" )
334 # Get the prefix and suffix for matching.
336 if [[ "$tpre" = */* ]]; then
344 # Force auto-mounting. There might be a better way...
345 # Commented out in the hope that `pws non-canonical hack'
346 # down below does this for us. Can be uncommented if it
349 # : ${^tmp1}/${PREFIX}${SUFFIX}/.(/)
351 # Get the matching files by globbing.
355 # Look for glob qualifiers.
356 # Extra nastiness to be careful about a quoted parenthesis.
357 # The initial tests look for parentheses with zero or an
358 # even number of backslashes in front.
359 # The later test looks for an outstanding quote.
360 if [[ ( -o bareglobqual && \
361 "$tpre/$tsuf" = (#b)((*[^\\]|)(\\\\)#\()([^\)]#) || \
363 "$tpre/$tsuf" = (#b)((*[^\\]|)(\\\\)#"(#q")([^\)]#) \
364 ) && -z $compstate[quote] ]]; then
365 compset -p ${#match[1]}
367 elif [[ "$tpre$tsuf" = */* ]]; then
368 compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake
369 elif [[ "$sopt" = *[/f]* ]]; then
370 compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake "$pats[@]"
372 compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" '' fake "$pats[@]"
374 tmp1=( $~tmp1 ) 2> /dev/null
376 if [[ -n "$PREFIX$SUFFIX" ]]; then
377 # See which of them match what's on the line.
379 # pws non-canonical hack which seems to work so far...
380 # if we didn't match by globbing, check that there is
381 # something to match by explicit name. This is for
382 # `clever' filing systems where names pop into existence
384 if (( ! $#tmp1 )); then
385 for tmp3 in "$tmp2[@]"; do
386 if [[ -n $tmp3 && $tmp3 != */ ]]; then
389 if [[ -e "$tmp3${(Q)PREFIX}${(Q)SUFFIX}" ]] then
390 tmp1+=("$tmp3${(Q)PREFIX}${(Q)SUFFIX}")
395 if (( ! $#tmp1 )); then
396 tmp2=( ${^tmp2}/$PREFIX$SUFFIX )
397 elif [[ "$tmp1[1]" = */* ]]; then
398 if [[ -n "$_comp_correct" ]]; then
400 builtin compadd -D tmp1 "$matcher[@]" - "${(@)tmp1:t}"
402 if [[ $#tmp1 -eq 0 ]]; then
404 compadd -D tmp1 "$matcher[@]" - "${(@)tmp2:t}"
408 compadd -D tmp1 "$matcher[@]" - "${(@)tmp1:t}"
412 compadd -D tmp1 "$matcher[@]" -a tmp1
415 # If no file matches, save the expanded path and continue with
418 if (( ! $#tmp1 )); then
419 if [[ "$tmp2[1]" = */* ]]; then
420 tmp2=( "${(@)tmp2#${prepath}${realpath}}" )
421 if [[ "$tmp2[1]" = */* ]]; then
422 tmp2=( "${(@)tmp2:h}" )
424 if [[ "$tmp2" = */ ]]; then
425 exppaths=( "$exppaths[@]" ${^tmp2}${tpre}${tsuf} )
427 exppaths=( "$exppaths[@]" ${^tmp2}/${tpre}${tsuf} )
429 elif [[ ${tpre}${tsuf} = */* ]]; then
430 exppaths=( "$exppaths[@]" ${tpre}${tsuf} )
432 ### this once was in an `else' (not `elif')
437 elif (( ! $#tmp1 )); then
438 # A little extra hack: if we were completing `foo/<TAB>' and `foo'
439 # contains no files, this will normally produce no matches and other
440 # completers might think that's it's their time now. But if the next
441 # completer is _correct or something like that, this will result in
442 # an attempt to correct a valid directory name. So we just add the
443 # original string in such a case so that the command line doesn't
444 # change but other completers still think there are matches.
445 # We do this only if we weren't given a `-g' or `-/' option because
446 # otherwise this would keep `_files' from completing all filenames
447 # if none of the patterns match.
449 if [[ -z "$tpre$tsuf" && -n "$pre$suf" ]]; then
450 pfxsfx=(-S '' "$pfxsfx[@]")
451 ### Don't remember what the break was good for. We explicitly
452 ### execute this only when there are no matches in the directory,
455 ### tmp1=( "$tmp2[@]" )
457 elif [[ -n "$haspats" && -z "$tpre$tsuf$suf" && "$pre" = */ ]]; then
460 compadd -nQS '' - "$linepath$donepath$orig"
466 if [[ -n "$ignpar" && -z "$_comp_no_ignore" &&
467 "$tpre$tsuf" != */* && $#tmp1 -ne 0 &&
468 ( "$ignpar" != *dir* || "$pats" = '*(-/)' ) &&
469 ( "$ignpar" != *..* || "$tmp1[1]" = *../* ) ]]; then
471 compfiles -i tmp1 _comp_ignore "$ignpar" "$prepath$realpath$donepath"
473 (( $#_comp_ignore && $mopts[(I)-F] )) ||
474 mopts=( "$mopts[@]" -F _comp_ignore )
477 # Step over to the next component, if any.
479 if [[ "$tpre" = */* ]]; then
481 elif [[ "$tsuf" = */* ]]; then
488 # There are more components, so skip over the next components and make a
491 tmp1=( ${tmp1//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )
492 tmp2="${(M)tpre##((.|..|)/)##}"
493 if [[ -n "$tmp2" ]]; then
501 # The next loop searches the first ambiguous component.
506 [[ -n "${prepath}${realpath}${testpath}" ]] &&
507 tmp1=( "${(@)tmp1#${prepath}${realpath}${testpath}}" )
511 # First we check if some of the files match the original string
512 # for this component. If there are some we remove all other
513 # names. This avoids having `foo' complete to `foo' and `foobar'.
514 # The return value is non-zero if the component is ambiguous.
516 compfiles -r tmp1 "${(Q)tmp3}"
519 if [[ "$tpre" = */* ]]; then
520 tmp2="${cpre}${tpre%%/*}"
521 PREFIX="${donepath}${linepath}${tmp2}"
522 SUFFIX="/${tpre#*/}${tsuf#*/}"
524 tmp2="${cpre}${tpre}"
525 PREFIX="${donepath}${linepath}${tmp2}"
529 # This once tested `|| [[ -n "$compstate[pattern_match]" &&
530 # "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]' but it should now be smart
531 # enough to handle multiple components with patterns.
534 # It is. For menu completion we now add the possible completions
535 # for this component with the unambiguous prefix we have built
536 # and the rest of the string from the line as the suffix.
537 # For normal completion we add the rests of the filenames
538 # collected as the suffixes to make the completion code expand
539 # it as far as possible.
542 if [[ -n "$linepath" ]]; then
543 compquote -p tmp2 tmp1
544 elif [[ -n "$tmp2" ]]; then
551 if [[ -z "$_comp_correct" &&
552 "$compstate[pattern_match]" = \* && -n "$listsfx" &&
553 "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then
558 # This once tested `-n $menu ||' but our menu-completion expert says
559 # that's not what we want.
561 if [[ -z "$compstate[insert]" ]] ||
562 { ! zstyle -t ":completion:${curcontext}:paths" expand suffix &&
564 ( -n "$_comp_correct" ||
565 -z "$compstate[pattern_match]" || "$SUFFIX" != */* ||
566 "${SUFFIX#*/}" = (|*[^\\])[][*?#~^\|\<\>]* ) ]] }; then
567 # We have not been told to insert the match, so we are
568 # listing, or something.
569 (( tmp4 )) && zstyle -t ":completion:${curcontext}:paths" ambiguous &&
571 if [[ "$tmp3" = */* ]]; then
572 if [[ -z "$listsfx" || "$tmp3" != */?* ]]; then
573 # I think this means we are expanding some directory
575 tmp1=("${(@)tmp1%%/*}")
576 _list_files tmp1 "$prepath$realpath$testpath"
577 compadd -Qf "$mopts[@]" -p "$linepath$tmp2" -s "/${tmp3#*/}" \
578 -W "$prepath$realpath$testpath" \
579 "$pfxsfx[@]" -M "r:|/=* r:|=*" \
583 # Same with a non-empty suffix
584 tmp1=("${(@)^tmp1%%/*}/${tmp3#*/}")
585 _list_files tmp1 "$prepath$realpath$testpath"
586 compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \
587 -W "$prepath$realpath$testpath" \
588 "$pfxsfx[@]" -M "r:|/=* r:|=*" \
593 _list_files tmp1 "$prepath$realpath$testpath"
594 compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \
595 -W "$prepath$realpath$testpath" \
596 "$pfxsfx[@]" -M "r:|/=* r:|=*" \
601 # We are inserting the match into the command line.
602 if [[ "$tmp3" = */* ]]; then
603 tmp4=( -Qf "$mopts[@]" -p "$linepath$tmp2"
604 -W "$prepath$realpath$testpath"
605 "$pfxsfx[@]" -M "r:|/=* r:|=*" )
606 if [[ -z "$listsfx" ]]; then
607 for i in "$tmp1[@]"; do
609 _list_files tmpdisp "$prepath$realpath$testpath"
610 compadd "$tmp4[@]" -s "/${i#*/}" $listopts - "$tmpdisp"
613 [[ -n "$compstate[pattern_match]" ]] && SUFFIX="${SUFFIX:s./.*/}*"
615 for i in "$tmp1[@]"; do
616 _list_files i "$prepath$realpath$testpath"
617 compadd "$tmp4[@]" $listopts - "$i"
621 _list_files tmp1 "$prepath$realpath$testpath"
622 compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \
623 -W "$prepath$realpath$testpath" \
624 "$pfxsfx[@]" -M "r:|/=* r:|=*" \
633 # If we have checked all components, we stop now and add the
634 # strings collected after the loop.
636 if [[ "$tmp3" != */* ]]; then
641 # Otherwise we add the unambiguous component to `testpath' and
642 # take it from the filenames.
644 testpath="${testpath}${tmp1[1]%%/*}/"
648 if [[ "$tpre" = */* ]]; then
649 if [[ -z "$_comp_correct" && -n "$compstate[pattern_match]" &&
650 "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then
651 cpre="${cpre}${tmp1[1]%%/*}/"
653 cpre="${cpre}${tpre%%/*}/"
656 elif [[ "$tsuf" = */* ]]; then
657 [[ "$tsuf" != /* ]] && mid="$testpath"
658 if [[ -z "$_comp_correct" && -n "$compstate[pattern_match]" &&
659 "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then
660 cpre="${cpre}${tmp1[1]%%/*}/"
662 cpre="${cpre}${tpre}/"
671 tmp1=( "${(@)tmp1#*/}" )
674 if [[ -z "$tmp4" ]]; then
675 if [[ "$mid" = */ ]]; then
679 tmp4="${testpath#${mid}}"
681 tmp2="${${mid%/}##*/}"
682 if [[ -n "$linepath" ]]; then
687 compquote tmp4 tmp2 tmp1
688 for i in "$tmp1[@]"; do
689 _list_files tmp2 "$prepath$realpath${mid%/*/}"
690 compadd -Qf "$mopts[@]" -p "$linepath$tmp3/" -s "/$tmp4$i" \
691 -W "$prepath$realpath${mid%/*/}/" \
692 "$pfxsfx[@]" -M "r:|/=* r:|=*" $listopts - "$tmp2"
695 if [[ "$osuf" = */* ]]; then
696 PREFIX="${opre}${osuf}"
703 if [[ -n "$linepath" ]]; then
704 compquote -p tmp4 tmp1
705 elif [[ -n "$tmp4" ]]; then
711 if [[ -z "$_comp_correct" && -n "$compstate[pattern_match]" &&
712 "${PREFIX#\~}$SUFFIX" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then
713 tmp1=("$linepath$tmp4${(@)^tmp1}")
714 _list_files tmp1 "$prepath$realpath"
715 compadd -Qf -W "$prepath$realpath" "$pfxsfx[@]" "$mopts[@]" \
716 -M "r:|/=* r:|=*" $listopts -a tmp1
718 # Not a pattern match
719 _list_files tmp1 "$prepath$realpath$testpath"
720 compadd -Qf -p "$linepath$tmp4" -W "$prepath$realpath$testpath" \
721 "$pfxsfx[@]" "$mopts[@]" -M "r:|/=* r:|=*" $listopts -a tmp1
727 # If we are configured to expand paths as far as possible and we collected
728 # expanded paths that are different from the string on the line, we add
729 # them as possible matches. Do that only if we are currently trying the
730 # last entry in the matcher-list style, otherwise other match specs might
731 # make the suffix that didn't match this time match in one of the following
734 if [[ _matcher_num -eq ${#_matchers} ]] &&
735 zstyle -t ":completion:${curcontext}:paths" expand prefix &&
736 [[ nm -eq compstate[nmatches] && $#exppaths -ne 0 &&
737 "$linepath$exppaths" != "$eorig" ]]; then
740 compadd -Q "$mopts[@]" -S '' -M "r:|/=* r:|=*" -p "$linepath" -a exppaths
743 [[ nm -ne compstate[nmatches] ]]