zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] Weird _expand & _complete behavior for $parameters in "double quotes"
Date: Tue, 11 May 2021 12:40:09 -0700	[thread overview]
Message-ID: <CAH+w=7YAeLjHGpQxAny=UqPGPz2Nrc3DBOhztS-mX=_9tjfT8A@mail.gmail.com> (raw)
In-Reply-To: <CAHLkEDs=K73cB=YRoHW_0MY+Kv-hqMWAoB=za2Hxu+d36J_2kQ@mail.gmail.com>

On Tue, May 11, 2021 at 10:32 AM Marlon Richert
<marlon.richert@gmail.com> wrote:
>
> On Tue, May 11, 2021 at 2:05 PM Bart Schaefer <schaefer@brasslantern.com> 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).


  reply	other threads:[~2021-05-11 19:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 10:24 Marlon Richert
2021-05-11 11:05 ` Bart Schaefer
2021-05-11 17:32   ` Marlon Richert
2021-05-11 19:40     ` Bart Schaefer [this message]
2021-05-12  6:43       ` Marlon Richert
2021-05-23 21:02     ` Lawrence Velázquez
2021-05-24 20:13       ` Bart Schaefer
2021-05-24 20:19         ` Daniel Shahaf

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=7YAeLjHGpQxAny=UqPGPz2Nrc3DBOhztS-mX=_9tjfT8A@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=marlon.richert@gmail.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).