On Mon, Jan 25, 2021 at 6:06 AM Peter Stephenson
wrote:
>
> > On 25 January 2021 at 00:52 Bart Schaefer wrote:
> > 2) Adopt (a CYGWIN-clean variant of) my patch from workers/47832, and
> > accept that some current usage of NO_CASE_GLOB will break.
> > 3) Add a setopt (CASE_DIRS ?) for the current behavior, and merge that
> > with workers/47832.
>
> I don't think 2) is so unreasonable in that only patterns with some
> form of case-insensitivity are involved. This is something of a minefield
> at the best of times and getting something that looks natural on systems
> that are intrinsically case-insensitive, whether or not case-preserving,
> is difficult. But with a new option it seems to provide a definite path
> forward in any case.
I interpret this as a stronger preference for #3 than for #2, so I've
taken a stab at it with the patch below.
> The only serious objection to that other that I
> can see is that it makes the code more complicated; the reply to that is
> if the code is simple there's a good chance it doesn't quite do what you
> need it to.
It's actually the documentation that gets more complicated, the code
is pretty simple. I rewrote the paragraph I've added to options.yo
about seven times and I'm still not entirely happy with it.
What I elected was to keep the current behavior by default, and add an
option to get the behavior that termux wants. I named it CASE_PATHS
for reasons I think the documentation paragraph make obvious.
Changing CASE_PATHS has no effect by itself; it only matters if
CASE_GLOB changes.
The default is CASE_GLOB + NO_CASE_PATHS, which gives you the normal
zsh behavior, but CASE_GLOB + CASE_PATHS is the same.
NO_CASE_GLOB + NO_CASE_PATHS gives the current behavior of NO_CASE_GLOB.
NO_CASE_GLOB + CASE_PATHS is the behavior required for descending
through protected directories, as needed by termux.
Attached again to avoid line wrap. No tests yet.