zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: undo in menu selection broken
Date: Wed, 28 Jun 2000 09:28:16 +0200 (MET DST)	[thread overview]
Message-ID: <200006280728.JAA31591@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Tue, 27 Jun 2000 18:50:23 +0400


Andrej Borsenkow wrote:

> It is probably the result of recent patch and hence partially my fault.
> undo'ing after accept-and-infer-next-history does not goes up but rather
> deletes one character on the line.
> 
> bor@itsrm2% cd ./AIX/
> Completing directory
> AIX/       Bsd/       CVS/       Core/      Linux/     X/
> Base/      Builtins/  Commands/  Debian/    User/
> bor@itsrm2% cd ./AIX/ (after a-a-i-n-h)
> bor@itsrm2% cd .AIX/  (after undo)

This patch makes menu-selection work with only one match when using
a-a-i-n-h. You can't move the cursor very much, for obvious reasons,
but at least it doesn't leave selection.

The patch should also fix the undoing behaviour (Andrej, in your
example you had typed `.', `/' and then TAB, right? guess what...).


What this patch does *not* do is fix the behaviour of a-a-i-n-h when
there is no match. I was thinking about making it just show some
message and let undo bring you back. Or maybe let it stay in the
selection it currently is in and show some message. But:

1) I wouldn't like to hard-wire this message, but adding a parameter
   just for this looks kinda weird.
   Or maybe just add a ZLS_COLOURS capability for it.
2) Setting the format style for the warnings tag to a value without a
   `%d' makes it add the descriptions of the things it tried as
   matches which gives a much better output than using `%d'. But with
   this, there's never a completion without matches and a-a-i-n-h
   happily starts completing the descriptions. So maybe a-a-i-n-h
   in menu-selection should set some parameter so that the shell code
   can find that out. Even better would be to change the complete
   module so that other modules like complist can put things into
   $compstate.

Well, we're getting vom hundertsten ins tausendste here...

Bye
 Sven

Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.33
diff -u -r1.33 compcore.c
--- Src/Zle/compcore.c	2000/06/22 08:42:37	1.33
+++ Src/Zle/compcore.c	2000/06/28 07:27:22
@@ -37,7 +37,7 @@
 /* Flags saying what we have to do with the result. */
 
 /**/
-int useexact, useline, uselist, forcelist, startauto;
+int useexact, useline, uselist, forcelist, iforcemenu, startauto;
 
 /* Non-zero if we should go back to the last prompt. */
 
@@ -349,7 +349,10 @@
 
     if (comppatmatch && *comppatmatch && comppatmatch != opm)
 	haspattern = 1;
-    if (useline < 0)
+    if (iforcemenu) {
+	do_ambig_menu();
+	ret = 0;
+    } else if (useline < 0)
 	ret = selfinsert(zlenoargs);
     else if (!useline && uselist) {
 	/* All this and the guy only wants to see the list, sigh. */
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.29
diff -u -r1.29 complist.c
--- Src/Zle/complist.c	2000/06/22 08:42:37	1.29
+++ Src/Zle/complist.c	2000/06/28 07:27:22
@@ -1782,11 +1782,15 @@
 	    menucmp = menuacc = hasoldlist = 0;
 	    minfo.cur = NULL;
 	    fixsuffix();
+	    handleundo();
 	    validlist = 0;
 	    amatches = pmatches = lastmatches = NULL;
 	    invalidate_list();
+	    iforcemenu = 1;
 	    menucomplete(zlenoargs);
-	    if (dat->num < 2 || !minfo.cur || !*(minfo.cur)) {
+	    iforcemenu = 0;
+
+	    if (dat->num < 1 || !minfo.cur || !*(minfo.cur)) {
 		noselect = clearlist = listshown = 1;
 		onlyexpl = 0;
 		zrefresh();
@@ -1821,6 +1825,7 @@
 	    s->origcs = origcs;
 	    s->origll = origll;
 	    accept_last();
+	    handleundo();
 	    do_menucmp(0);
 	    mselect = (*(minfo.cur))->gnum;
 
@@ -1852,6 +1857,7 @@
 	    if (!u)
 		break;
 
+	    handleundo();
 	    cs = 0;
 	    foredel(ll);
 	    spaceinline(l = strlen(u->line));
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.20
diff -u -r1.20 compresult.c
--- Src/Zle/compresult.c	2000/06/16 07:52:05	1.20
+++ Src/Zle/compresult.c	2000/06/28 07:27:22
@@ -1093,7 +1093,7 @@
 /* This handles the beginning of menu-completion. */
 
 /**/
-static void
+void
 do_ambig_menu(void)
 {
     Cmatch *mc;

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-06-28  7:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-28  7:28 Sven Wischnowsky [this message]
2000-06-28  8:11 ` Andrej Borsenkow
2000-06-28  9:02 Sven Wischnowsky
2000-06-28  9:11 ` Andrej Borsenkow
2000-06-28  9:16 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=200006280728.JAA31591@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).