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

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



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

Mikael reverted his change which handled odd characters in completion
functions by adding quoting such as with (q) flags in several places.

How about the following approach instead which just excludes such files
entirely. Or will this make things slower.

Oliver

diff --git a/Completion/compinit b/Completion/compinit
index 5cb527fac..2bfd30f2e 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -520,7 +520,7 @@ if [[ -z "$_i_done" ]]; then
   for _i_dir in $fpath; do
     [[ $_i_dir = . ]] && continue
     (( $_i_wdirs[(I)$_i_dir] )) && continue
-    for _i_file in $_i_dir/^([^_]*|*~|*.zwc)(N); do
+    for _i_file in $_i_dir/^([^_]*|*[\;\|\&]*|*~|*.zwc)(N); do
       _i_name="${_i_file:t}"
       (( $+_i_test[$_i_name] + $_i_wfiles[(I)$_i_file] )) && continue
       _i_test[$_i_name]=yes




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