Re: [BUG+PATCH] Wrong name sort.



On Mon, Mar 05, 2007 at 07:49:06PM +0100, Martin Petricek wrote:

> I have files sorted by name, case insensitive sort. However, the
> sorting seems to be behaving strangely, as bunch of files that should
> be sorted before or after filter.cc and filter.h (not sure if "." is
> before or after letters while sorting) got stuffed in the listing
> between these two files. Seems to me like dots are ignored when
> sorting at all,

Yes, this is how strcoll() behaves in many locales. You don't like it, but
others may.

> I think one extra test should be added there:
> if "a.b" is sorted between "aa" and "ac", do not use strcoll
> See attached patch which does exactly that.

I don't think this kind of autodetection is the right way. Actually I think
this is a very wrong way.

If you think strcoll() behaves buggy for one particular language, go and fix
that locale, or set your LC_COLLATE variable to use some other locale for
sorting (e.g. export LC_COLLATE=C).

Perhaps it might make sense to have an option in mc where you can _manually_
choose between strcmp() and strcoll() (but hey, that's what LC_COLLATE is
for!), but doing such kind of autodetection is the worst I can imagine --
no-one would ever understand what and why mc does unless s/he looks at the
source. This behavior would be absolutely counterintuitive.



-- 
Egmont



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]