zsh-workers
 help / color / mirror / code / Atom feed
* Path with spaces in _canonical_paths
@ 2022-11-18 17:41 thomas
  2022-11-21  3:57 ` Bart Schaefer
  0 siblings, 1 reply; 17+ messages in thread
From: thomas @ 2022-11-18 17:41 UTC (permalink / raw)
  To: zsh-workers

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-11-24 18:52 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 17:41 Path with spaces in _canonical_paths thomas
2022-11-21  3:57 ` Bart Schaefer
2022-11-21 10:47   ` thomas
2022-11-21 16:30     ` Bart Schaefer
2022-11-21 17:41       ` Thomas Gläßle
2022-11-21 21:32         ` Bart Schaefer
2022-11-23 14:13           ` Daniel Shahaf
2022-11-23 21:36             ` Bart Schaefer
2022-11-23 22:24               ` Daniel Shahaf
2022-11-23 22:42                 ` Bart Schaefer
2022-11-23 23:06                   ` Daniel Shahaf
2022-11-23 23:12                     ` Bart Schaefer
2022-11-24  0:12                       ` Daniel Shahaf
2022-11-24 18:42                         ` Bart Schaefer
2022-11-23 23:36                   ` Thomas Gläßle
2022-11-23 23:40                     ` Thomas Gläßle
2022-11-24 18:51                     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).