Zsh Mailing List Archive
Messages sorted by:
Re: [BUG] Weird _expand & _complete behavior for $parameters in "double quotes"
- X-seq: zsh-workers 48822
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Marlon Richert <marlon.richert@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [BUG] Weird _expand & _complete behavior for $parameters in "double quotes"
- Date: Tue, 11 May 2021 12:40:09 -0700
- Archived-at: <https://zsh.org/workers/48822>
- In-reply-to: <CAHLkEDs=K73cB=YRoHW_0MY+Kv-hqMWAoB=za2Hxu+d36J_2kQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHLkEDsHb-5RqCZbSwyE4xE+7W04Ojq-9xikXo67ozRh_KdWyQ@mail.gmail.com> <CAH+w=7ZvLbNQ+OoijxWVLjMAf84ZXWhgxKY8k35BRw4izemail@example.com> <CAHLkEDs=K73cB=YRoHW_0MY+Kv-hqMWAoB=za2Hxu+d36J_2kQ@mail.gmail.com>
On Tue, May 11, 2021 at 10:32 AM Marlon Richert
> On Tue, May 11, 2021 at 2:05 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > I can't reproduce this on either Ubutu or MacOS, nor either with or
> > without my completeinword patch from the other day.
> Here's the test as a patch, in case it helps you reproduce it.
Ah, I didn't get before that you'd added an entire new test case.
There are two things going on here:
One, complete-in-word handling of quotes has several problems, which
I've unsuccessfully wrestled with once or twice before. Completion
wants to remove the quotes, complete what is inside them, and then put
back the most appropriate quotes for the end result, which aren't
always the same as the original quotes ... and it can get pretty
confused along the way. So the first TAB replaces "$ba" with "$ba""
because it recognizes the ambiguous prefix but forgets (so to speak)
that there's already a trailing quote.
Two, on the next tab when _expand sees the extra quote, it concludes
that $ba is the entire variable to be expanded, and replaces it with
the empty string. The quotes then all themselves get quoted (see "put
back the most appropriate"+"confused"), leaving \"\"\".
This may be in some way related to the do_ambiguous() discussion from
workers/39123 all the way back in 2016, which never got any further
(and the patch from workers/39968 never did get committed, but it
doesn't help with this quoting situation).
Messages sorted by: