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

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



On Sat, Jun 8, 2024 at 3:56 PM Jun. T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
>
>
> > 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?

Hmm, I thought I was clever, but not clever enough. I should probably
move my quoting to the place that calls compdef with the filename
arguments instead of quoting it inside compdef.

-- 
Mikael Magnusson




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