zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: complist
Date: Wed, 7 Jul 1999 10:23:20 +0200 (MET DST)	[thread overview]
Message-ID: <199907070823.KAA09782@beta.informatik.hu-berlin.de> (raw)


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@informatik.hu-berlin.de


             reply	other threads:[~1999-07-07  8:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-07  8:23 Sven Wischnowsky [this message]
1999-07-09  7:47 ` accept-and-infer-next-history in path completion Andrej Borsenkow
1999-07-09  8:56 PATCH: complist Sven Wischnowsky
1999-07-09  9:55 ` Andrej Borsenkow
2000-05-22  8:42 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199907070823.KAA09782@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).