Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Improve quote handling in _ant completion
- X-seq: zsh-workers 52337
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: German Riano <griano@xxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: Improve quote handling in _ant completion
- Date: Wed, 29 Nov 2023 20:56:25 +0100
- Archived-at: <https://zsh.org/workers/52337>
- In-reply-to: <CAH+w=7YUfXaHAL=PR1tGB4J6gy7HDAbfwnPtiV4wzCpPC6ZFdw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <207461559.9336309.1701221332233.ref@mail.yahoo.com> <207461559.9336309.1701221332233@mail.yahoo.com> <CAH+w=7YUfXaHAL=PR1tGB4J6gy7HDAbfwnPtiV4wzCpPC6ZFdw@mail.gmail.com>
On 11/29/23, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Tue, Nov 28, 2023 at 5:30 PM German Riano <griano@xxxxxxxxx> wrote:
>>
>> In the current completion, if a task description contains a quote (') the
>> completions do not render properly
>>
>> In this patch I propose to build the tmp array via
>> tmp=( ${(f@)"$(command)"} )
>> and print one line at a time.
>
> Does this smaller change work instead? (I suspect the "eval" could be
> eliminated by tweaking this further.)
>
> diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant
> index 36c7c0e89..aea3f51ec 100644
> --- a/Completion/Unix/Command/_ant
> +++ b/Completion/Unix/Command/_ant
> @@ -122,7 +122,7 @@ case $state in
> read default_target junk
> fi
> # Output target again indicating its the default one.
> - print -n "'${default_target}:(Default target) ' "
> + print -rn -- "${(qq):-${default_target}:(Default
> target) } "
> ;;
>
> (Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time:*)
> ;;
>
>> Also I am proposing to shield 'find_targets' with '((
>> $#functions[find_targets] )) ||' so that users can easily override the
>> function.
>
> No particular objection to this, though I wonder if it should be tied
> to the "targets" style and _call_program (Oliver?)
It should probably also be renamed to _ant_find_targets or something
similar, it's very unexpected that a completer pollutes the main
function namespace.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author