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

Re: PATCH: Improve quote handling in _ant completion



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?)




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