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

PATCH: complist



Yes, I was in a really weird mood yesterday...

This makes accept-and-infer-next-history be treated specially when in
menu-selection. It accepts the current match and immediatly starts
completion again. So if you have a list of files, place the mark on a
directory and execute a-a-i-n-h, you can select files in that
directory. Of course it would be nice to be able to go back again,
e.g. with undo, but implementing that is a bit more complicated...

Bye
 Sven

diff -u -r kos/Zle/complist.c Src/Zle/complist.c
--- kos/Zle/complist.c	Wed Jul  7 09:13:22 1999
+++ Src/Zle/complist.c	Wed Jul  7 09:13:48 1999
@@ -645,6 +645,7 @@
 static int
 domenuselect(Hookdef dummy, Chdata dat)
 {
+    static Chdata fdat = NULL;
     Cmatch **p;
     Cmgroup *pg;
     Thingy cmd;
@@ -652,10 +653,15 @@
     int i = 0, acc = 0;
     char *s;
 
-    if (dummy && (!(s = getsparam("SELECTMIN")) ||
-		  (dat && dat->num < atoi(s))))
+    if (fdat || (dummy && (!(s = getsparam("SELECTMIN")) ||
+			   (dat && dat->num < atoi(s))))) {
+	if (fdat) {
+	    fdat->matches = dat->matches;
+	    fdat->num = dat->num;
+	}
 	return 0;
-
+    }
+    fdat = dat;
     selectlocalmap(mskeymap);
     noselect = 0;
     mselect = (*(minfo.cur))->gnum;
@@ -686,6 +692,18 @@
 	else if (cmd == Th(z_acceptline)) {
 	    acc = 1;
 	    break;
+	} else if (cmd == Th(z_acceptandinfernexthistory)) {
+	    menucmp = 0;
+	    menucomplete(zlenoargs);
+	    if (dat->num < 2 || !minfo.cur || !*(minfo.cur)) {
+		noselect = 1;
+		break;
+	    }
+	    clearlist = 1;
+	    zrefresh();
+	    clearlist = 0;
+	    mselect = (*(minfo.cur))->gnum;
+	    continue;
 	} else if (cmd == Th(z_acceptandhold) ||
 		 cmd == Th(z_acceptandmenucomplete)) {
 	    Menustack s = (Menustack) zhalloc(sizeof(*s));
@@ -858,6 +876,7 @@
 	showinglist = -2;
 	zrefresh();
     }
+    fdat = NULL;
     return (!noselect ^ acc);
 }
 
diff -u -r kos/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- kos/Zle/zle_tricky.c	Wed Jul  7 09:13:23 1999
+++ Src/Zle/zle_tricky.c	Wed Jul  7 09:13:48 1999
@@ -4372,6 +4372,7 @@
 	    cs = origcs;
 	    clearlist = 1;
 	    ret = 1;
+	    minfo.cur = NULL;
 	    goto compend;
 	}
 	if (comppatmatch && *comppatmatch && comppatmatch != opm)
diff -u kod/Zsh/mod_complist.yo Doc/Zsh/mod_complist.yo
--- kod/Zsh/mod_complist.yo	Wed Jul  7 09:13:29 1999
+++ Doc/Zsh/mod_complist.yo	Wed Jul  7 10:22:35 1999
@@ -100,12 +100,16 @@
 functions. The zle functions tt(send-break) and tt(accept-line) can be used
 to leave menu-selection, leaving the match currently inserted into the line
 in place. In the case of tt(accept-line), the match currently inserted
-will be accepted and the immediatly trying completion again will
+will be accepted and immediatly trying completion again will
 complete after it. Using tt(send-break) leaves menu-selection and
 continues with normal menu-completion. The functions tt(accept-and-hold) and
 tt(accept-and-menu-complete) can be used to accept the match currently
 inserted and continue inserting matches after that. Matches inserted this
-way can be removed by invoking the tt(undo) function. Keys bound to one of
+way can be removed by invoking the tt(undo) function. The function
+tt(accept-and-infer-next-history) accepts the current match and
+immediatly tries completion with menu-selection again. In the case of
+files this allows one to select a directory and then to directly
+continue with completing files in it. Keys bound to one of
 the completion functions will cycle to the next (or, in case of
 tt(reverse-menu-complete), the previous) match, and the tt(redisplay) and
 tt(clear-screen) functions work as usual without leaving

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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