about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-18 09:46:07 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-18 09:46:07 +0000
commit437294af796f2c1530ef942f53c823ba0753556f (patch)
tree0ed0cf72a78272e2da5fb8ccca1d131a9c3f2ddd
parentb852c1f6cf50aaa37c9d2e8cbeb63f74b9e5d01f (diff)
downloadzsh-437294af796f2c1530ef942f53c823ba0753556f.tar.gz
zsh-437294af796f2c1530ef942f53c823ba0753556f.tar.xz
zsh-437294af796f2c1530ef942f53c823ba0753556f.zip
zsh-workers/8313
-rw-r--r--Completion/Core/_main_complete1
-rw-r--r--Completion/Core/_path_files4
-rw-r--r--Completion/Core/compinit5
-rw-r--r--Doc/Zsh/compsys.yo11
-rw-r--r--Src/Zle/zle_tricky.c34
5 files changed, 32 insertions, 23 deletions
diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete
index 460b3aba9..304a97828 100644
--- a/Completion/Core/_main_complete
+++ b/Completion/Core/_main_complete
@@ -60,6 +60,7 @@ comppostfuncs=()
 
 _lastdescr=( "\`${(@)^_lastdescr:#}'" )
 if [[ compstate[nmatches] -eq 0 &&
+      compstate[matcher] -eq compstate[total_matchers] &&
       -n "$compconfig[warning_format]" && $#_lastdescr -ne 0 ]]; then
   local str
 
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index eb9c06da6..6e23f46aa 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -347,7 +347,7 @@ for prepath in "$prepaths[@]"; do
 	SUFFIX=""
       fi
 
-      if [[ -n $menu ]]; then
+      if [[ -n $menu || "$compconfig[path_expand]" != *suffix* ]]; then
         [[ -n "$compconfig[path_cursor]" ]] && compstate[to_end]=''
         if [[ "$tmp3" = */* ]]; then
 	  compadd -Qf -p "$linepath${testpath:q}" -s "/${tmp3#*/}" \
@@ -418,7 +418,7 @@ done
 
 exppaths=( "${(@)exppaths:#$orig}" )
 
-if [[ -n "$compconfig[path_expand]" &&
+if [[ "$compconfig[path_expand]" = *prefix* &&
       $#exppaths -gt 0 && nm -eq compstate[nmatches] ]]; then
   PREFIX="${opre}${osuf}"
   SUFFIX=""
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index 16148a945..ca9240f92 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -368,7 +368,7 @@ compconf() {
 
 # Utility function to call a function if it exists.
 #
-# Usage: call <return> <name> [ <args> ... ]
+# Usage: funcall <return> <name> [ <args> ... ]
 #
 # If a function named <name> is defined (or defined to be autoloaded),
 # it is called. If <return> is given not the string `-' or empty, it is
@@ -385,10 +385,11 @@ funcall() {
 
   shift
 
-  if builtin functions "$1"; then
+  if builtin functions "$1" >& /dev/null; then
     "$@"
     _ret="$?"
     [[ -n "$_name" ]] && eval "${_name}=${_ret}"
+    compstate[restore]=''
     return 0
   fi
   return 1
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index f57416e3a..5e313e904 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -720,9 +720,16 @@ from the tt(compadd) builtin.
 Finally, the tt(_path_files) function supports two configuration keys.
 startitem()
 item(tt(path_expand))(
-If this is set to any non-empty string, the partially
+If this is set to a string containing `tt(prefix)', the partially
 typed path from the line will be expanded as far as possible even if
-trailing pathname components can not be completed.
+trailing pathname components can not be completed. If it contains the
+substring `tt(suffix)' and normal (non-menu-) completion is used,
+matching names for components after the first ambiguous one will be
+added, too. 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), this will also cycle through the names
+of the files in pathname components after the first ambiguous one.
 )
 item(tt(path_cursor))(
 If this is set to a non-empty string, the cursor will be left
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 70371b41c..dd11c2d28 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -4118,23 +4118,6 @@ addmatches(Cadata dat, char **argv)
 		    llpl -= pl;
 		    lpre += pl;
 		}
-		if (comppatmatch && *comppatmatch) {
-		    int is = (*comppatmatch == '*');
-		    char *tmp = (char *) zhalloc(2 + llpl + llsl);
-
-		    strcpy(tmp, lpre);
-		    tmp[llpl] = 'x';
-		    strcpy(tmp + llpl + is, lsuf);
-
-		    tokenize(tmp);
-		    remnulargs(tmp);
-		    if (haswilds(tmp)) {
-			if (is)
-			    tmp[llpl] = Star;
-			if ((cp = patcompile(tmp, 0, NULL)))
-			    haspattern = 1;
-		    }
-		}
 	    }
 	    /* Now duplicate the strings we have from the command line. */
 	    if (dat->ipre)
@@ -4196,6 +4179,23 @@ addmatches(Cadata dat, char **argv)
 		    else
 			*argv = NULL;
 		}
+		if (comppatmatch && *comppatmatch) {
+		    int is = (*comppatmatch == '*');
+		    char *tmp = (char *) zhalloc(2 + llpl + llsl);
+
+		    strcpy(tmp, lpre);
+		    tmp[llpl] = 'x';
+		    strcpy(tmp + llpl + is, lsuf);
+
+		    tokenize(tmp);
+		    remnulargs(tmp);
+		    if (haswilds(tmp)) {
+			if (is)
+			    tmp[llpl] = Star;
+			if ((cp = patcompile(tmp, 0, NULL)))
+			    haspattern = 1;
+		    }
+		}
 	    }
 	    if (*argv) {
 		if (dat->pre)