about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-11 11:14:51 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-11 11:14:51 +0000
commit3076ed44d33ac699b306824214951c436c4a7a4e (patch)
tree2c743b047da4a14c36586dbf5011d80cc09e86b2 /Completion
parent55b8857726ee7daf75b3dc1c1dd3ca4235868fd3 (diff)
downloadzsh-3076ed44d33ac699b306824214951c436c4a7a4e.tar.gz
zsh-3076ed44d33ac699b306824214951c436c4a7a4e.tar.xz
zsh-3076ed44d33ac699b306824214951c436c4a7a4e.zip
zsh-workers/9677
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Commands/_read_comp9
-rw-r--r--Completion/Core/_approximate15
-rw-r--r--Completion/Core/_expand4
-rw-r--r--Completion/Core/_main_complete57
-rw-r--r--Completion/Core/_match10
5 files changed, 29 insertions, 66 deletions
diff --git a/Completion/Commands/_read_comp b/Completion/Commands/_read_comp
index a956c65f7..bc6e4c3c6 100644
--- a/Completion/Commands/_read_comp
+++ b/Completion/Commands/_read_comp
@@ -26,14 +26,7 @@
 setopt localoptions extendedglob nobadpattern # xtrace promptsubst
 # local PS4='%N:%i:$((#key))> '
 
-# Took me ages to work this out.  If we're not on the first global
-# matcher specification, we mustn't do any I/O.
-if [[ compstate[matcher] -gt 1 && -z $_read_comp ]]; then
-  return 1
-fi
-
-if [[ compstate[matcher] -gt 1 ||
-  ( ${+NUMERIC} = 0 && -n $_read_comp ) ]]; then
+if [[ ${+NUMERIC} = 0 && -n $_read_comp ]]; then
   if [[ $_read_comp = _* ]]; then
     eval $_read_comp
   else
diff --git a/Completion/Core/_approximate b/Completion/Core/_approximate
index ef6e5b91d..989eeba11 100644
--- a/Completion/Core/_approximate
+++ b/Completion/Core/_approximate
@@ -8,10 +8,6 @@
 local _comp_correct _correct_expl comax cfgacc
 local curcontext="${curcontext}" oldcontext opm="$compstate[pattern_match]"
 
-# Only if all global matchers have been tried.
-
-[[ compstate[matcher] -ne compstate[total_matchers] ]] && return 1
-
 # We don't try correction if the string is too short.
 
 [[ "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
@@ -60,16 +56,7 @@ compadd() {
   builtin compadd "$_correct_expl[@]" "$@"
 }
 
-# Now initialise our counter. We also set `compstate[matcher]'
-# to `-1'. This allows completion functions to use the simple
-# `[[ compstate[matcher] -gt 1 ]] && return' to avoid being
-# called for multiple global match specs and still be called 
-# again when correction is done. Also, this makes it easy to
-# test if correction is attempted since `compstate[matcher]'
-# will never be set to a negative value by the completion code.
-
 _comp_correct=1
-compstate[matcher]=-1
 
 [[ -z "$compstate[pattern_match]" ]] && compstate[pattern_match]='*'
 
@@ -98,7 +85,6 @@ while [[ _comp_correct -le comax ]]; do
       [[ "$compstate[list]" != list* ]] &&
           compstate[list]="$compstate[list] force"
     fi
-    compstate[matcher]="$compstate[total_matchers]"
     unfunction compadd
     compstate[pattern_match]="$opm"
 
@@ -109,7 +95,6 @@ while [[ _comp_correct -le comax ]]; do
   (( _comp_correct++ ))
 done
 
-compstate[matcher]="$compstate[total_matchers]"
 unfunction compadd
 compstate[pattern_match]="$opm"
 
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index b1609ad40..e92c7966b 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -18,10 +18,6 @@ if zstyle -s ":completion:${curcontext}:" completions expr &&
   return 1
 fi
 
-# Do this only for the first global matcher.
-
-[[ "$compstate[matcher]" -le 1 ]] || return 1
-
 # In exp we will collect the expansion.
 
 exp=("$word")
diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete
index 33a492bae..2381ae76d 100644
--- a/Completion/Core/_main_complete
+++ b/Completion/Core/_main_complete
@@ -128,8 +128,7 @@ if (( $compstate[nmatches] )); then
       fi
     fi
   fi
-elif [[ compstate[matcher] -eq compstate[total_matchers] &&
-        $#_lastdescr -ne 0 ]] &&
+elif [[ $#_lastdescr -ne 0 ]] &&
      zstyle -s ":completion:${curcontext}:warnings" format format; then
   local str
 
@@ -148,34 +147,30 @@ elif [[ compstate[matcher] -eq compstate[total_matchers] &&
   compadd -UX "$format" -n ''
 fi
 
-if [[ compstate[matcher] -eq compstate[total_matchers] ||
-      compstate[nmatches] -ne 0 ]]; then
-
-  # See which tags were or were not used.
-
-  _used_tags=( "${(@)_tried_tags:#${(j:|:)~${(@)_failed_tags//\[/\\[}//\]/\\]}}" )
-  _unused_tags=( "${(@)_offered_tags:#${(j:|:)~${(@)_used_tags//\[/\\[}//\]/\\]}}" )
-
-  # Now call the post-functions.
-
-  for post in "$comppostfuncs[@]"; do
-    "$post"
-  done
-  comppostfuncs=()
-
-  _lastcomp=( "${(@kv)compstate}" )
-  _lastcomp[completer]="$comp"
-  _lastcomp[prefix]="$PREFIX"
-  _lastcomp[suffix]="$SUFFIX"
-  _lastcomp[iprefix]="$IPREFIX"
-  _lastcomp[isuffix]="$ISUFFIX"
-  _lastcomp[qiprefix]="$QIPREFIX"
-  _lastcomp[qisuffix]="$QISUFFIX"
-  _lastcomp[offered_tags]="${(j.:.)_offered_tags}"
-  _lastcomp[tried_tags]="${(j.:.)_tried_tags}"
-  _lastcomp[failed_tags]="${(j.:.)_failed_tags}"
-  _lastcomp[unused_tags]="${(j.:.)_unused_tags}"
-  _lastcomp[used_tags]="${(j.:.)_used_tags}"
-fi
+# See which tags were or were not used.
+
+_used_tags=( "${(@)_tried_tags:#${(j:|:)~${(@)_failed_tags//\[/\\[}//\]/\\]}}" )
+_unused_tags=( "${(@)_offered_tags:#${(j:|:)~${(@)_used_tags//\[/\\[}//\]/\\]}}" )
+
+# Now call the post-functions.
+
+for post in "$comppostfuncs[@]"; do
+  "$post"
+done
+comppostfuncs=()
+
+_lastcomp=( "${(@kv)compstate}" )
+_lastcomp[completer]="$comp"
+_lastcomp[prefix]="$PREFIX"
+_lastcomp[suffix]="$SUFFIX"
+_lastcomp[iprefix]="$IPREFIX"
+_lastcomp[isuffix]="$ISUFFIX"
+_lastcomp[qiprefix]="$QIPREFIX"
+_lastcomp[qisuffix]="$QISUFFIX"
+_lastcomp[offered_tags]="${(j.:.)_offered_tags}"
+_lastcomp[tried_tags]="${(j.:.)_tried_tags}"
+_lastcomp[failed_tags]="${(j.:.)_failed_tags}"
+_lastcomp[unused_tags]="${(j.:.)_unused_tags}"
+_lastcomp[used_tags]="${(j.:.)_used_tags}"
 
 return ret
diff --git a/Completion/Core/_match b/Completion/Core/_match
index 42416242d..ad481f23b 100644
--- a/Completion/Core/_match
+++ b/Completion/Core/_match
@@ -12,12 +12,10 @@
 local tmp opm="$compstate[pattern_match]" ret=0 orig ins
 local curcontext="${curcontext/:[^:]#:/:match:}"
 
-# Do nothing if we don't have a pattern or there are still global
-# match specifications to try.
+# Do nothing if we don't have a pattern.
 
 tmp="${${:-$PREFIX$SUFFIX}#[~=]}"
-[[ "$tmp:q" = "$tmp" ||
-   compstate[matcher] -ne compstate[total_matchers] ]] && return 1
+[[ "$tmp:q" = "$tmp" ]] && return 1
 
 zstyle -s ":completion:${curcontext}:" original orig
 zstyle -b ":completion:${curcontext}:" insert-unambiguous ins
@@ -25,11 +23,9 @@ zstyle -b ":completion:${curcontext}:" insert-unambiguous ins
 # Try completion without inserting a `*'?
 
 if [[ -n "$orig" ]]; then
-  compstate[matcher]=-1
   compstate[pattern_match]='-'
   _complete && ret=1
   compstate[pattern_match]="$opm"
-  compstate[matcher]="$compstate[total_matchers]"
 
   if (( ret )); then
     [[ "$ins" = yes &&
@@ -43,11 +39,9 @@ fi
 
 [[ "$orig" = only ]] && return 1
 
-compstate[matcher]=-1
 compstate[pattern_match]='*'
 _complete && ret=1
 compstate[pattern_match]="$opm"
-compstate[matcher]="$compstate[total_matchers]"
 
 [[ ret -eq 1 && "$ins" = yes &&
    $#compstate[unambiguous] -ge ${#:-${PREFIX}${SUFFIX}} ]] &&