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

Re: PATCH: Handle completer filenames with funny characters in them



> 2024/03/19 0:17、Mikael Magnusson <mikachu@xxxxxxxxx>のメール:
> 
> For example, a file called _foo;bar will cause this to happen:
> % hello [press tab]zsh: command not found: _foo
> zsh: command not found: bar

With this patch the following has stopped working:

% compdef '_files -g "*.h"' foo
% foo <TAB>
foo (eval):1: command not found: _files -g "*.h"

> @@ -412,7 +412,7 @@ compdef() {
> 	      svc=
>             fi
>             if [[ -z "$new" || -z "${_comps[$1]}" ]]; then
> -              _comps[$cmd]="$func"
> +              _comps[$cmd]="${(q)func}"
> 	      [[ -n "$svc" ]] && _services[$cmd]="${1#*\=}"
> 	    fi

I don't know what is the best solution.
Quote only if $func is a single word?,
or quote only the first word of $func?



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