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

Re: [BUG] complist interactive mode overwrites command line



On Sat, Jul 16, 2022 at 11:11 AM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> The issue seems to be that interactive mode assumes you're going to
> use it interactively -- as in, type a single character at a time until
> you've reduced the set to only one match -- so it only adjusts the
> buffer spacing on single keystrokes.  When you accept with TAB (or
> ENTER) domenuselect() is relying on do_single() to fix everything up,
> but the state required by do_single() is not fully populated.  I don't
> know precisely what else is needed, though, and am out of time to
> study it today.

Had to take a break from other stuff (weather too hot) so came back to
look at this.

I believe the following fixes it.  The example from Marlon's report
works, even after interactively typing the first few letters before
accepting.
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 0dc64db6a..f12c14e8e 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -2447,6 +2447,8 @@ domenuselect(Hookdef dummy, Chdata dat)
             strncpy(zlemetaline, origline, l);
             zlemetacs = origcs;
             setmstatus(status, NULL, 0 , 0, NULL, NULL, NULL);
+	    minfo.end -= minfo.len;
+	    minfo.len = 0;
         } else if (strpfx("search", s)) {
             mode = (strstr(s, "back") ? MM_BSEARCH : MM_FSEARCH);
         }


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