Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: diff completion problem.



Tanaka Akira wrote:

> Z(2):akr@flux% Src/zsh -f
> flux% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> flux% zstyle '*:descriptions' format '%d'
> flux% diff -ur <TAB>
> new file
> CVS/                LICENCE             _w3m                config.sub*
> ChangeLog           META-FAQ            acconfig.h          configure*
> ...
> 
> Hm.  zsh completes files as new file.  It should be `original file'.

Whoa. How did that survive?

Wrong return value in the function testing for multiple single-letter
options in the same string.


That stuff in _main_complete tries to do the right thing when a
completion function uses _message, i.e. it stops trying other
completers and doesn't print the warnings. Sorry for putting this in
the same patch.

Bye
 Sven

Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.36
diff -u -r1.36 _main_complete
--- Completion/Core/_main_complete	2000/07/12 09:25:18	1.36
+++ Completion/Core/_main_complete	2000/07/13 10:59:26
@@ -156,6 +156,8 @@
     fi
     (( _matcher_num++ ))
   done
+  [[ -n "$_comp_mesg" ]] && break
+
   (( _completer_num++ ))
 done
 
@@ -265,7 +267,7 @@
 elif [[ nm -le 1 && -n "$_comp_mesg" ]]; then
   compstate[insert]=''
   compstate[list]='list force messages'
-elif [[ nm -eq 0 &&
+elif [[ nm -eq 0 && -z "$_comp_mesg" &&
         $#_lastdescr -ne 0 && $compstate[old_list] != keep ]] &&
      zstyle -s ":completion:${curcontext}:warnings" format format; then
 
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.36
diff -u -r1.36 computil.c
--- Src/Zle/computil.c	2000/06/26 08:36:43	1.36
+++ Src/Zle/computil.c	2000/07/13 10:59:38
@@ -1088,7 +1088,7 @@
 static Caopt
 ca_get_sopt(Cadef d, char *line, char **end, LinkList *lp)
 {
-    Caopt p;
+    Caopt p, pp = NULL;
     char pre = *line++;
     LinkList l = NULL;
 
@@ -1112,11 +1112,12 @@
 	    }
 	} else if (!p || (p && !p->active))
 	    return NULL;
+	pp = p;
 	p = NULL;
     }
-    if (p && end)
+    if (pp && end)
 	*end = line;
-    return p;
+    return pp;
 }
 
 /* Return the n'th argument definition. */

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author