zsh-workers
 help / color / mirror / code / Atom feed
* menu-select interactive mode
@ 2011-04-09 14:56 Mikael Magnusson
  2011-04-09 15:02 ` Mikael Magnusson
  0 siblings, 1 reply; 15+ messages in thread
From: Mikael Magnusson @ 2011-04-09 14:56 UTC (permalink / raw)
  To: zsh workers

We were talking on irc about this, and I couldn't get it to work.
Turns out if you just set
zstyle ':completion:*' menu interactive
and invoke the menu-select widget, nothing happens. What you have to
do is either
zstyle ':completion:*' menu select interactive
but then you always get menu selection which you might not want (I
don't), so I ended up with this instead
zle -C menu-select-interactive menu-complete _generic
zstyle ':completion:menu-select-interactive:*' menu select interactive
bindkey "^[m"  menu-select-interactive

(^[m was previously set to menu-select)

Is this intended or a bug? The _main_complete code leading up to
setting MENUMODE isn't very obvious to me.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: menu-select interactive mode
@ 2011-04-26  0:06 Jun T.
  0 siblings, 0 replies; 15+ messages in thread
From: Jun T. @ 2011-04-26  0:06 UTC (permalink / raw)
  To: zsh workers

At 11:38 -0700 11/04/24, Bart Schaefer wrote:
> I think what *should* happen (from the user's
>point of view) is that the line is restored back to just "ls " (the
>starting point of menu completion) before selection begins.

Yes, that is much more user friendly.

> That is
>stored in the global struct "minfo" but I don't know the conditions
>in which it's OK to access that

I *guess* it may be OK at least when minfo.cur != NULL.

> and whether minfo.pos points into a
>metafied or unmetafied line.

I believe minfo.pos points into zlemetaline. The only explicit assignment
to minfo.pos is at compresult.c:971 and :1329.

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...).


By the way, is it possible to continue the interactive mode after
accepting a match by hitting Return? 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. 
But I believe it is just too much hope.


Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.124
diff -u -r1.124 complist.c
--- Src/Zle/complist.c	24 Apr 2011 19:10:20 -0000	1.124
+++ Src/Zle/complist.c	25 Apr 2011 16:23:22 -0000
@@ -2390,6 +2390,11 @@
     else {
 	wasmeta = 0;
 	metafy_line();
+	if(minfo.cur) {
+	    origline = dupstrpfx(zlemetaline,minfo.pos);
+	    origcs = minfo.pos;
+	    origll = minfo.end;
+	}
     }
     
     if ((s = getsparam("MENUSCROLL"))) {


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-04-26 16:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-09 14:56 menu-select interactive mode 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
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.

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).