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

Re: PATCH: Improve quote handling in _ant completion



On Fri, Dec 1, 2023 at 11:20 AM German Riano <griano@xxxxxxxxx> wrote:
>
> $ln could have quotes in the description. For example "Run tests but don't do fail"
> [...]
>
>    print -n "'${default_target}:(Default target) ' "
>
> The extra space after the ')' is no needed. It causes no big harm, but it's not needed.

Apologies again for accidentally squirting this into an unrelated thread.
diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant
index 36c7c0e89..91428b854 100644
--- a/Completion/Unix/Command/_ant
+++ b/Completion/Unix/Command/_ant
@@ -122,13 +122,13 @@ 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:*)
                 ;;
                 (*)
                     # Return target and description
-                    print -n "'$ln' "
+                    print -rn -- "${(qq)ln} "
                 ;;
             esac
           done


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