Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Path with spaces in _canonical_paths
- X-seq: zsh-workers 50996
- From: <thomas@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Path with spaces in _canonical_paths
- Date: Fri, 18 Nov 2022 17:41:37 +0000
- Archived-at: <https://zsh.org/workers/50996>
- List-id: <zsh-workers.zsh.org>
Hi all,
I'm trying to use `_canonical_paths` (on zsh 5.9) to let the user autocomplete
a fixed list of files. I hope I'm not using it incorrectly. Otherwise: It
seems to not escape spaces in paths appropriately. Short example:
compdef '_canonical_paths -N files files /tmp/My\ File' cmd
cmd <Tab>
Shows the following completions:
/tmp/My File (appears twice)
/tmp/My\ File
i.e. I get in total 3 entries for the same path, and notably, the first option
is without escaping the space, i.e. it will result in a command line:
cmd /tmp/My File
which is obviously not as intended.
I tried scanning the code in /usr/share/zsh/functions/Completion/Unix/
_canonical_paths for the problem, but it is quite confusing to me. I was able
to gather that by removing the `-Q` from the line
_wanted "$tag" expl "$desc" compadd $__gopts -Q -U -a matches && ret=0
it adds escapes to all the entries, i.e. the new completions are:
/tmp/My\ File (twice)
/tmp/My\\\ File
which is still not as desired.
Much appreciated if anyone can help.
Best, Thomas
Messages sorted by:
Reverse Date,
Date,
Thread,
Author