zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: menu-select interactive mode
Date: Mon, 25 Apr 2011 17:55:57 -0700	[thread overview]
Message-ID: <110425175557.ZM1922@torch.brasslantern.com> (raw)
In-Reply-To: <a06240800c9db5111c85e@kba.biglobe.ne.jp>

On Apr 26,  2:06am, Jun T. wrote:
}
} I have no idea why the else block is the appropriate place to
} set origline etc, but anyway the following patch seems to solve
} the *current* problem (but may break somewhere else...).

The else block is appropriate because that's where metafy_line() is
called ... if you look at docomplete() zle_tricky.c:629 you'll see
where the metafy and setup of origline occur when menu selection is
entered automatically rather than explicitly.

I can't explain why the code paths are so different, other than for
the usual historical reasons.

} By the way, is it possible to continue the interactive mode after
} accepting a match by hitting Return?

No, hitting accept-line takes you entirely out of menu completion,
so you're starting over with a new menu at that point.

} I tried hitting ESC-m again
} after the Return but it didn't work (either with or without the
} following patch, although the behavior was different).
} Hitting a key bound to accept-and-hold didn't work either. 

It should work to accept-and-hold if you do so *instead* of hitting
return, but not after.

} Index: Src/Zle/complist.c
} ===================================================================
} +	if(minfo.cur) {
} +	    origline = dupstrpfx(zlemetaline,minfo.pos);
} +	    origcs = minfo.pos;
} +	    origll = minfo.end;
} +	}

I think this is almost right -- origll should probably be set to
minfo.pos rather than minfo.end, and to be thorough there probably
ought to be an "else" for the case where minfo.cur is NULL (but I
suspect it's not possible for that to happen).


Index: Src/Zle/complist.c
===================================================================
--- complist.c	21 Dec 2010 16:41:16 -0000
+++ complist.c	26 Apr 2011 00:48:39 -0000
@@ -2390,8 +2390,19 @@
     else {
 	wasmeta = 0;
 	metafy_line();
+	if (minfo.cur) {
+	  /* Restore state when menu completion began */
+	  origline = dupstrpfx(zlemetaline, minfo.pos);
+	  origcs = minfo.pos;
+	  origll = minfo.pos;
+	} else {
+	  /* This branch may be unreachable */
+	  origline = dupstring(zlemetaline);
+	  origcs = zlemetacs;
+	  origll = zlemetall;
+	}
     }
-    
+
     if ((s = getsparam("MENUSCROLL"))) {
 	if (!(step = mathevali(s)))
 	    step = (lines - nlnct) >> 1;


  parent reply	other threads:[~2011-04-26  0:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 14:56 Mikael Magnusson
2011-04-09 15:02 ` Mikael Magnusson
     [not found]   ` <BANLkTinRkfcNJWnYnooq SDWTYG2q1VrcZQ@mail.gmail.com>
2011-04-09 20:12   ` Bart Schaefer
2011-04-09 20:58     ` Mikael Magnusson
     [not found]       ` <110410074855.ZM9428@ torch.brasslantern.com>
2011-04-10 14:48       ` Bart Schaefer
2011-04-10 15:37         ` Mikael Magnusson
2011-04-10 18:50           ` Bart Schaefer
2011-04-10 19:19             ` Mikael Magnusson
2011-04-24 10:40             ` Jun T.
2011-04-24 18:38               ` Bart Schaefer
     [not found]                 ` <a06240800c9db5111c85e@kba.biglobe.ne.jp>
2011-04-26  0:55                   ` Bart Schaefer [this message]
2011-04-26 16:31                     ` Jun T.
2011-04-24 12:18         ` Jun T.
2011-04-24 19:13           ` Bart Schaefer
2011-04-26  0:06 Jun T.

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=110425175557.ZM1922@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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).