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

RE: zsh-3.1.5-pws-5: mixing "old" and "new" completions?



Andrej Borsenkow wrote:

> >   `compcall' accepts no other option or argument, for now. It would
> >   be easy to make it accept arguments for the command line words to
> >   use, for the command name to use, etc. If this turns out to be
> >   interesting to have, I'll add it.
> 
> I won't be able to test it for some time, but this occured to me today:
> 
> compctl -T -K " __default"
> 
> function __default() {
> 	compcall -T
> }

Damn. Yesterday I thought about this, but today I forget to handle
it. Since there is no easy way to correctly avoid recursions, let's
use a depth counter (until we find a better solution, if we ever find
a better solution).

Bye
 Sven

--- os/Zle/zle_tricky.c	Wed Jan 27 16:16:32 1999
+++ Src/Zle/zle_tricky.c	Wed Jan 27 16:18:58 1999
@@ -3449,10 +3449,21 @@
     } SWITCHBACKHEAPS;
 }
 
+/* A simple counter to avoid endless recursion between old and new style *
+ * completion. */
+
+static int cdepth = 0;
+
+#define MAX_CDEPTH 16
+
 /**/
 void
 makecomplistctl(int flags)
 {
+    if (cdepth == MAX_CDEPTH)
+	return;
+
+    cdepth++;
     SWITCHHEAPS(compheap) {
 	HEAPALLOC {
 	    int ooffs = offs, lip, lp;
@@ -3488,6 +3499,7 @@
 	    clwpos = op;
 	} LASTALLOC;
     } SWITCHBACKHEAPS;
+    cdepth--;
 }
 
 /* This function gets the compctls for the given command line and *

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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