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

Re: email to zsh



Peter Stephenson wrote:
> I can get this now.  From zsh -f, any recent version, in an empty
> directory:
> 
> files=(AIWebKitMessageViewController.m
> AIWebKitMessageViewPlugin.m
> AIWebkitMessageViewStyle.m)
> touch $files
> chmod +x *.m
> compctl -M '' 'm:{a-zA-Z}={A-Za-z}'
> ./AIWebKitMessagep
> 
> then TAB will cause it to happen.  I think the compctl -M is the key:
> it's somewhere in the hairy matcher code.

This seems to fix the problem, and allow the completion to work as
expected, though I haven't a clue what the code I've fixed is doing.

Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.42
diff -u -r1.42 compmatch.c
--- Src/Zle/compmatch.c	4 Jun 2004 06:00:40 -0000	1.42
+++ Src/Zle/compmatch.c	6 Jul 2005 09:47:39 -0000
@@ -803,14 +803,26 @@
 		    /* Probably add the matched strings. */
 		    if (!test) {
 			if (sfx)
-			    add_match_str(NULL, NULL, w, ow - w, sfx);
+			{
+			    if (ow >= w)
+				add_match_str(NULL, NULL, w, ow - w, sfx);
+			}
 			else
-			    add_match_str(NULL, NULL, ow, w - ow, sfx);
+			{
+			    if (w >= ow)
+				add_match_str(NULL, NULL, ow, w - ow, sfx);
+			}
 			add_match_str(mp, tl, tw, mp->wlen, sfx);
 			if (sfx)
-			    add_match_sub(NULL, NULL, 0, w, ow - w);
+			{
+			    if (ow >= w)
+				add_match_sub(NULL, NULL, 0, w, ow - w);
+			}
 			else
-			    add_match_sub(NULL, NULL, 0, ow, w - ow);
+			{
+			    if (w >= ow)
+				add_match_sub(NULL, NULL, 0, ow, w - ow);
+			}
 			add_match_sub(mp, tl, mp->llen, tw, mp->wlen);
 		    }
 		    if (sfx) {

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



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