about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-10-17 11:07:47 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-10-17 11:07:47 +0000
commit47f979381ff34e83ff006897ce52c3692cd06c05 (patch)
treeb0d46e18b45cfa5361632ebee46021e9786fcadd
parentf9eb4b60bd5ee425689fdd3f7b65f120ed719917 (diff)
downloadzsh-47f979381ff34e83ff006897ce52c3692cd06c05.tar.gz
zsh-47f979381ff34e83ff006897ce52c3692cd06c05.tar.xz
zsh-47f979381ff34e83ff006897ce52c3692cd06c05.zip
various old patches ported back
-rw-r--r--ChangeLog19
-rw-r--r--Completion/Base/Core/_main_complete2
-rw-r--r--Completion/Unix/Type/_path_files25
-rw-r--r--Doc/Zsh/compsys.yo10
-rw-r--r--Src/Zle/compcore.c13
5 files changed, 56 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index c9de6226d..1a46ca6f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2001-10-17  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 16002: Completion/Unix/Type/_path_files: use expanded paths
+	(expand style with value prefix) only when we are at the last
+	matcher spec
+
+	* 15991: Src/Zle/compcore.c: hide all but one match with the
+	same string in the list even for unsorted groups
+
+	* 15944: Completion/Unix/Type/_path_files, Doc/Zsh/compsys.yo:
+	make expand style (file completion) work again; no more special
+	behaviour with menu completion; try to make docs clearer
+
+	* 15653: Completion/Base/Core/_main_complete: make insert-tab
+	really default to `true'
+
+	* 15615: Completion/Unix/Type/_path_files: -[12n] options don't
+	get arguments
+
 2001-10-16  Bart Schaefer  <schaefer@zsh.org>
 
 	* 15812: Doc/Zsh/zle.yo: Cross-reference parameters used by ZLE.
diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index 5d1f15f3a..5960b2da7 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -33,7 +33,7 @@ typeset -U _lastdescr _comp_ignore _comp_colors
 
 [[ -z "$curcontext" ]] && curcontext=:::
 
-zstyle -s ":completion:${curcontext}:" insert-tab tmp || tmp=no
+zstyle -s ":completion:${curcontext}:" insert-tab tmp || tmp=yes
 
 if [[ ( "$tmp" = *pending(|[[:blank:]]*) && PENDING -gt 0 ) ||
       ( "$tmp" = *pending=(#b)([0-9]##)(|[[:blank:]]*) &&
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 598dc466b..cd18b6b25 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -17,7 +17,7 @@ exppaths=()
 zparseopts -a mopts \
     'P:=pfxsfx' 'S:=pfxsfx' 'q=pfxsfx' 'r:=pfxsfx' 'R:=pfxsfx' \
     'W:=prepaths' 'F:=ignore' 'M+:=matcher' \
-    J+: V+: X+: 1: 2: n: 'f=tmp1' '/=tmp1' 'g+:-=tmp1'
+    J+: V+: X+: 1 2 n 'f=tmp1' '/=tmp1' 'g+:-=tmp1'
 
 sopt="-${(@j::M)${(@)tmp1#-}#?}"
 (( $tmp1[(I)-[/g]*] )) && haspats=yes
@@ -328,6 +328,8 @@ for prepath in "$prepaths[@]"; do
 
     # Get the matching files by globbing.
 
+    tmp2=( "$tmp1[@]" )
+
     if [[ "$tpre$tsuf" = */* ]]; then
       compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher" "$sdirs" fake
     elif [[ "$sopt" = *[/f]* ]]; then
@@ -340,7 +342,9 @@ for prepath in "$prepaths[@]"; do
     if [[ -n "$PREFIX$SUFFIX" ]]; then
       # See which of them match what's on the line.
 
-      if [[ "$tmp1[1]" = */* ]]; then
+      if (( ! $#tmp1 )); then
+        tmp2=( ${^tmp2}/$PREFIX$SUFFIX )
+      elif [[ "$tmp1[1]" = */* ]]; then
         if [[ -n "$_comp_correct" ]]; then
           tmp2=( "$tmp1[@]" )
           builtin compadd -D tmp1 -F _comp_ignore "$matcher[@]" - "${(@)tmp1:t}"
@@ -501,12 +505,15 @@ for prepath in "$prepaths[@]"; do
         SUFFIX="$osuf"
       fi
 
-      if [[ -n $menu || -z "$compstate[insert]" ]] ||
-         ! zstyle -t ":completion:${curcontext}:paths" expand suffix ||
+      # This once tested `-n $menu ||' but our menu-completion expert says
+      # that's not what we want.
+
+      if [[ -z "$compstate[insert]" ]] ||
+         { ! zstyle -t ":completion:${curcontext}:paths" expand suffix &&
            [[ -z "$listsfx" &&
               ( -n "$_comp_correct" ||
                 -z "$compstate[pattern_match]" || "$SUFFIX" != */* ||
-                "${SUFFIX#*/}" = (|*[^\\])[][*?#~^\|\<\>]* ) ]]; then
+                "${SUFFIX#*/}" = (|*[^\\])[][*?#~^\|\<\>]* ) ]] }; then
         (( tmp4 )) && zstyle -t ":completion:${curcontext}:paths" ambiguous &&
             compstate[to_end]=
         if [[ "$tmp3" = */* ]]; then
@@ -645,9 +652,13 @@ done
 
 # If we are configured to expand paths as far as possible and we collected
 # expanded paths that are different from the string on the line, we add
-# them as possible matches.
+# them as possible matches. Do that only if we are currently trying the
+# last entry in the matcher-list style, otherwise other match specs might
+# make the suffix that didn't match this time match in one of the following
+# attempts.
 
-if zstyle -t ":completion:${curcontext}:paths" expand prefix &&
+if [[ _matcher_num -eq ${#_matchers} ]] &&
+   zstyle -t ":completion:${curcontext}:paths" expand prefix &&
    [[ nm -eq compstate[nmatches] && $#exppaths -ne 0 &&
       "$exppaths" != "$eorig" ]]; then
   PREFIX="${opre}"
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 085d912ef..7ee9818c3 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1064,15 +1064,15 @@ the file tt(/etc/resolv.conf).
 kindex(expand, completion style)
 item(tt(expand))(
 This style is used when completing strings consisting of multiple
-parts, such as path names.  If its
-value contains the string `tt(prefix)', the partially typed word from
+parts, such as path names.  If one of its values is
+the string `tt(prefix)', the partially typed word from
 the line will be expanded as far as possible even if trailing parts
-cannot be completed.  If it contains the string `tt(suffix)'
-and normal (non-menu-) completion is used, matching names for
+cannot be completed.  If one of its values is the string `tt(suffix)',
+matching names for
 components after the first ambiguous one will also be added.  This
 means that the resulting string is the longest unambiguous string
 possible, but if menu completion is started on the list of matches
-generated this way (e.g. due to the option tt(AUTO_MENU) being set),
+generated this way,
 this will also cycle through the names of the files in pathname
 components after the first ambiguous one.
 )
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 97ed6d58f..94cb914d8 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -2641,6 +2641,8 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
 	    }
 	} else {
 	    if (!(flags & CGF_UNIQALL) && !(flags & CGF_UNIQCON)) {
+                int dup;
+
 		for (ap = rp; *ap; ap++) {
 		    for (bp = cp = ap + 1; *bp; bp++) {
 			if (!matcheq(*ap, *bp))
@@ -2649,6 +2651,17 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
 			    n--;
 		    }
 		    *cp = NULL;
+                    if (!(*ap)->disp) {
+                        for (dup = 0, bp = ap + 1; *bp; bp++)
+                            if (!(*bp)->disp &&
+                                !((*bp)->flags & CMF_MULT) &&
+                                !strcmp((*ap)->str, (*bp)->str)) {
+                                (*bp)->flags |= CMF_MULT;
+                                dup = 1;
+                            }
+                        if (dup)
+                            (*ap)->flags |= CMF_FMULT;
+                    }
 		}
 	    } else if (!(flags & CGF_UNIQCON)) {
 		int dup;