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

Re: compset -q appends the match after the typed word when the quoted word holds \"



On Tue, Nov 10, 2026 at 10:46 AM Yufei Pan <discodization@xxxxxxxxx> wrote:
>
> Hello,
>
>     zsh -f
>     autoload -U compinit; compinit
>     _zzq() { compset -q; _files }
>     compdef _zzq zzq
>     touch zzfile
>     zzq "cat \"\" zz<TAB>
>
> gives  zzq "cat \"\" zzfilezz  (expected  zzq "cat \"\" zzfile ).
>
> Also  zzq "grep \"a b\" zz<TAB>  gives  ... zzfilezz . It is fine
> without the escaped quotes ( zzq "cat a zz<TAB>  gives zzfile) and in
> single quotes ( zzq 'cat "" zz<TAB>  gives zzfile).
>
> Seen on 5.9.2 (Debian unstable), 5.9 (Debian 12) and 5.0.2 (CentOS 7).
>
> I am not subscribed to the list; please Cc me on replies.

The current compset -q is horribly broken and can't work in the
general case. I tried to rework it a bit a while ago but I felt like
the abyss started staring back at me. The current expectation I have
of the code is basically: be happy it works when it does.

-- 
Mikael Magnusson




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