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

Re: completion: highlight matching part



[> workers]

On Aug 3, 10:31am, Bart Schaefer wrote:
} Subject: Re: completion: highlight matching part
}
} The complist module installs some defaults if $LS_COLORS is empty.  The
} problem is that the form beginning with an equal or a star is supposed
} to take precedence over those defaults, but it does not.  Instead (if
} I'm reading the code correctly) it takes precedence only over explicit
} settings of all the possible $LS_COLORS colorings.

I've tracked this (by a much more roundabout route than necessary) to
PWS's patch 25006, in which he asserts (for compatibility with GNU ls)
that "File type tests from stat should come before extension tests."

The documentation still says that extension tests win and file type
tests come last, so this should have been changed at the same time
that complist.c was modified.  But clearly in this instance we want
pattern tests to take precedence over file type tests.  I don't think
there's any equivalent in GNU ls to this particular zsh-ism, so we
have several choices:

(1) Change complist.c:putfilecol() so that pattern tests come first,
    then mode tests, and finally extension tests.

(2) Do something convoluted where we check for an extension match,
    but if we find one, try the mode tests before returning the
    extension color.  We end up with a sort of rock-paper-scissors
    behavior, where modes beat extensions beat patterns beat modes.

(3) Simply update the doc and make it impossible to do what Tomasz
    originally asked for, except in old versions of the shell that
    are not GNU ls compatible.

(4) Revert to the pre-25006 behavior.

Obviously the doc needs updating no matter what (in case 4, to point
out that we're not compatible with ls).

I have the impression that prior to this discussion the backref-using
patterns for completion coloring were not particularly widespread, so
it probably won't cause any major upheaval whichever way we go.



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