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

Re: Bug in completion with menucomplete and no insertion



Peter Stephenson wrote:

> Presumably something nasty is happening to memory somewhere before that
> point.  I checked and it's not even specific to -s: other mistakes in the
> get_compctl() called from bin_compgen() do the same thing.  The common
> factor seems to be that none of the commands produce matches or insert
> anything.  It seems to need menucomplete set as well; I've reproduced it
> after zsh -f, compinit, setopt nobeep menucomplete (nobeep is only
> necessary for sanity).

Right. For the quote-code I had to add to restore the command line
when no completion could be generated (because get_comp_string()
removes the quote from the line and changing that would have changed
all command line positions held by the completion code). It had
planned to look at this again and then forgot to do so.

> By the way, I've applied the following trivial patch to zle_tricky.c
> for shared-library purposes.

Oh no... I'm sorry.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Mon Jun  7 13:00:08 1999
+++ Src/Zle/zle_tricky.c	Tue Jun  8 08:51:11 1999
@@ -66,7 +66,7 @@
 /* The line before completion was tried. */
 
 static char *origline;
-static int origll, origcs;
+static int origcs;
 
 /* wb and we hold the beginning/end position of the word we are completing. */
 
@@ -864,7 +864,6 @@
     /* Get the word to complete. */
     noerrs = 1;
     origline = dupstring((char *) line);
-    origll = ll;
     origcs = cs;
     s = get_comp_string();
     DPUTS(wb < 0 || cs < wb || cs > we,
@@ -4337,9 +4336,9 @@
 	/* Make sure we have the completion list and compctl. */
 	if (makecomplist(s, incmd, lst)) {
 	    /* Error condition: feeeeeeeeeeeeep(). */
-	    zsfree((char *) line);
-	    line = (unsigned char *) ztrdup(origline);
-	    ll = origll;
+	    cs = 0;
+	    foredel(ll);
+	    inststr(origline);
 	    cs = origcs;
 	    feep();
 	    clearlist = 1;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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