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

Re: menu-select interactive mode



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"))) {



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