zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Andrea Manenti <andrea.manenti@yahoo.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] complist interactive mode overwrites command line
Date: Sat, 16 Jul 2022 15:57:49 -0700	[thread overview]
Message-ID: <CAH+w=7ZHtt1g-vRAEsiKZHZ2rYZjQU4vMRqcM0Tq4XrkTqy2Cw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Zq-0X1DnSW7vORP5B64PN0pzQ2UX2bDfWk8405YDXfrA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

On Sat, Jul 16, 2022 at 11:11 AM Bart Schaefer
<schaefer@brasslantern.com> 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.

[-- Attachment #2: complist.txt --]
[-- Type: text/plain, Size: 516 bytes --]

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);
         }

  reply	other threads:[~2022-07-16 23:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8964126.CDJkKcVGEf.ref@phy-nordri>
2022-07-15 13:39 ` Andrea Manenti
2022-07-16 18:11   ` Bart Schaefer
2022-07-16 22:57     ` Bart Schaefer [this message]
     [not found]       ` <2844417.e9J7NaK4W3@phy-nordri>
2022-07-22 16:32         ` Bart Schaefer
2022-07-22 17:55           ` Bart Schaefer
2022-07-22 18:23             ` Bart Schaefer
2022-07-22 19:10               ` Andrea Manenti
2023-11-17  3:35     ` Bart Schaefer
2021-08-04 16:30 Marlon Richert
2024-03-04  1:44 ` Samy Dulor
2024-03-04  2:05   ` Bart Schaefer
2024-03-04  6:33     ` Bart Schaefer
2024-03-04 11:30       ` Samy Dulor
2024-03-04 22:38         ` Bart Schaefer

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='CAH+w=7ZHtt1g-vRAEsiKZHZ2rYZjQU4vMRqcM0Tq4XrkTqy2Cw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=andrea.manenti@yahoo.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).