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

Re: Case-insensitive completion (Re: tab completion bug?)



On Oct 24,  8:20am, Bart Schaefer wrote:
}
} The actual culprit is the call to compadd at line 705, which adds the
} unexpanded variable as the "original string" but passes the expanded
} path prefix (with the inexact capitalization) as the -W option.

Aha, aha, aha ... if I try it with no_case_glob but use the exact
capitalization in $sites, it's revealed that prefix is supposed to be
removed at lines 612-613 but THAT match is case-sensitive, so we pass
full paths to compadd in the first place, which sets up the failure
of -W.

So this seems to fix it:

diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index ed3f54d..c64ebf5 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -609,8 +609,15 @@ for prepath in "$prepaths[@]"; do
   tmp3="$pre$suf"
   tpre="$pre"
   tsuf="$suf"
-  [[ -n "${prepath}${realpath}${testpath}" ]] &&
+  if [[ -n "${prepath}${realpath}${testpath}" ]]
+  then
+    if [[ -o nocaseglob ]]
+    then
+      tmp1=( "${(@)tmp1#(#i)${prepath}${realpath}${testpath}}" )
+    else
       tmp1=( "${(@)tmp1#${prepath}${realpath}${testpath}}" )
+    fi
+  fi
 
   while true; do
 



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