Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion problems on cygwin when nocaseglob is set
- X-seq: zsh-users 12100
- From: Peter Stephenson <pws@xxxxxxx>
- To: "Zsh Users" <zsh-users@xxxxxxxxxx>
- Subject: Re: Completion problems on cygwin when nocaseglob is set
- Date: Wed, 24 Oct 2007 16:09:34 +0100
- In-reply-to: <20a807210710240701w1f83e299k8dfcf6e658adffff@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <DD74FBB8EE28D441903D56487861CD9D223A0DF0@xxxxxxxxxxxxxxxxxxxxxx> <DD74FBB8EE28D441903D56487861CD9D224E86E7@xxxxxxxxxxxxxxxxxxxxxx> <20071022123128.2db6000c@news01> <DD74FBB8EE28D441903D56487861CD9D224E8A05@xxxxxxxxxxxxxxxxxxxxxx> <20071023101151.3757a369@news01> <DD74FBB8EE28D441903D56487861CD9D225F6432@xxxxxxxxxxxxxxxxxxxxxx> <200710231156.l9NBuQwA019246@xxxxxxxxxxxxxx> <DD74FBB8EE28D441903D56487861CD9D225F6859@xxxxxxxxxxxxxxxxxxxxxx> <20071023165708.41f29476@news01> <DD74FBB8EE28D441903D56487861CD9D22719439@xxxxxxxxxxxxxxxxxxxxxx> <20a807210710240701w1f83e299k8dfcf6e658adffff@xxxxxxxxxxxxxx>
"Vin Shelton" wrote:
> I'm very confused. Running zsh built from the latest CVS sources,
> here's what I see:
... even with NO_CASE_GLOB set, completion doesn't match
case-insensitively unless there's a matcher spec to do it.
Oh dear, I hate it when people are confused about completion because
that invariably means a hard time.
It looks like _path_files is doing the right thing internally (via
compfiles, which understands glob settings), but it then passes the
matched string to compadd without the -U flag, which says "sorry mate,
it's more than my job's worth to match case-insensitively". _path_files
does most of its file handling itself or via compfiles, but it doesn't
do the special matching stuff, hence we can't pass -U in that case.
We could make a rule that we use case-insensitive matching with
NO_CASE_GLOB unless an explicit matcher spec is in force, I suppose, but
we can't actually have the combined effect of nocaseglob and matchers
without either some kind of internal rewrite, or editing the matchers
passed down through _path_files. If the former is acceptable, this is
fairly straightforward.
Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.25
diff -u -r1.25 _path_files
--- Completion/Unix/Type/_path_files 7 Mar 2006 12:52:27 -0000 1.25
+++ Completion/Unix/Type/_path_files 24 Oct 2007 15:08:14 -0000
@@ -101,7 +101,16 @@
(( $mopts[(I)-F] )) || mopts=( "$mopts[@]" -F _comp_ignore )
fi
-(( $#matcher )) && mopts=( "$mopts[@]" "$matcher[@]" )
+if [[ $#matcher -eq 0 && -o nocaseglob ]]; then
+ # If globbing is case insensitive and there's no matcher,
+ # do case-insensitive matching.
+ matcher=( -M 'm:{a-zA-Z}={A-Za-z}' )
+fi
+
+if (( $#matcher )); then
+ # Add the current matcher to the options to compadd.
+ mopts=( "$mopts[@]" "$matcher[@]" )
+fi
if zstyle -s ":completion:${curcontext}:" file-sort tmp1; then
case "$tmp1" in
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.202
diff -u -r1.202 compsys.yo
--- Doc/Zsh/compsys.yo 19 Jun 2007 09:28:06 -0000 1.202
+++ Doc/Zsh/compsys.yo 24 Oct 2007 15:08:22 -0000
@@ -1968,6 +1968,11 @@
one to three strings will give acceptable performance. On the other
hand, putting multiple space-separated values into the same string does
not have an appreciable impact on performance.
+
+If there is no current matcher or it is empty, and the option
+tt(NO_CASE_GLOB) is in effect, the matching for files is performed
+case-insensitively in any case. However, any matcher must
+explicitly specify case-insensitive matching if that is required.
)
kindex(max-errors, completion style)
item(tt(max-errors))(
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author