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

PATCH: Re: Correction oddity



Peter Stephenson wrote:

> ...
> 
> finds _correct_group is 3; I presume this is the index of the -J or -V
> argument in the compadd command,
> 
>   compadd -M m:{a-zA-Z}={A-Za-z} -M corrections \
> -X Completing corrections -M r:|[_-]=* r:|=* -D equal -
> 
> and indeed it is that `-M' which should be -J or -V.  Unfortunately it
> becomes -M because there's no -J or -V in the argument list, and in that
> case ${argv[(R)-*[JV]]} returns the first argument --- dunno if that's a
> bug, it doesn't seem so hot, but it's presumably not the root bug.
> Getting that test to check if the reverse match turned up something
> sensible might be a start, but I'm way out of my depth.

It's really the root bug.  I didn't think of cases where there is no
-[JV] passed to compadd.

Ahem.


Bye
  Sven

Index: Completion/Base/Completer/_approximate
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_approximate,v
retrieving revision 1.4
diff -u -r1.4 _approximate
--- Completion/Base/Completer/_approximate	2001/08/07 10:38:36	1.4
+++ Completion/Base/Completer/_approximate	2001/08/16 08:03:05
@@ -59,7 +59,8 @@
       PREFIX="(#a${_comp_correct})$PREFIX"
     # fi
 
-    (( $_correct_group )) && _correct_expl[_correct_group]=${argv[(R)-*[JV]]}
+    (( $_correct_group && $argv[(I)-*[JV]] )) &&
+        _correct_expl[_correct_group]=${argv[(R)-*[JV]]}
 
     builtin compadd "$_correct_expl[@]" "$@"
   }

-- 
Sven Wischnowsky                    wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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