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

Re: Fun with zsh (Re: Associative array ordering (Re: Example function))



Bart Schaefer wrote:

> On Feb 2,  3:59am, Bart Schaefer wrote:
> } Subject: Re: Fun with zsh (Re: Associative array ordering (Re: Example fun
> }
> } On Feb 2, 12:42pm, Helmut Jarausch wrote:
> } } array> '(*.bz)AIcons-1.5.tar.bz2bzip -dc'
> } }               ^^^^^^^^^^^^^^^^^^   where does this come from?
> } 
> } If you did cut and paste, that's showing up because there's a tab
> } 
> } That's obviously wrong here in more ways than one, and in fact my own
> } just-compiled copy of zsh dumps core when I do the same thing.
> 
> I think this fixes it; at least, it prevents my crash, but I'm not sure
> it's otherwise correct.  Help, Sven!

[I was just writing my answer to Bart's previous message when this
came, a few seconds later...]

> -    char *s = findcmd(cmdstr, 1);
> +    char *s = incmd ? findcmd(cmdstr, 1) : os;

`incmd' is non-zero if we are completing the command string itself
(first word). So this would make `pattern compctl's be correctly
lookup up only when completing that.

Use the one below instead, which avoids using `pattern compctl's if we 
are not completing a for a normal command.

In the previous message Bart wrote:

> That's obviously wrong here in more ways than one, and in fact my own
> just-compiled copy of zsh dumps core when I do the same thing.

I'm not sure, in which ways zsh is wrong to do completion here. After
all, it gets TABs. And even inside array values completion may be
useful, don't you think?


Bye
 Sven

--- os/Zle/zle_tricky.c	Mon Feb  1 10:54:28 1999
+++ Src/Zle/zle_tricky.c	Tue Feb  2 13:18:02 1999
@@ -3667,10 +3667,11 @@
     }
     /* Then search the pattern compctls, with the command name and the *
      * full pathname of the command. */
-    makecomplistpc(os, incmd);
-    if (!(ccont & CC_CCCONT))
-	return;
-
+    if (cmdstr) {
+	makecomplistpc(os, incmd);
+	if (!(ccont & CC_CCCONT))
+	    return;
+    }
     /* If the command string starts with `=', try the path name of the *
      * command. */
     if (cmdstr && cmdstr[0] == Equals) {

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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