Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] complist interactive mode overwrites command line
- X-seq: zsh-workers 50414
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Andrea Manenti <andrea.manenti@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [BUG] complist interactive mode overwrites command line
- Date: Sat, 16 Jul 2022 15:57:49 -0700
- Archived-at: <https://zsh.org/workers/50414>
- In-reply-to: <CAH+w=7Zq-0X1DnSW7vORP5B64PN0pzQ2UX2bDfWk8405YDXfrA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <8964126.CDJkKcVGEf.ref@phy-nordri> <8964126.CDJkKcVGEf@phy-nordri> <CAH+w=7Zq-0X1DnSW7vORP5B64PN0pzQ2UX2bDfWk8405YDXfrA@mail.gmail.com>
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