Review Request: Add global option to turn off "natural sorting" of user visible strings.

Matthew Woehlke mw_triad at users.sourceforge.net
Tue Aug 18 00:48:27 BST 2009


(FYI, you don't need to CC me on this list...)

Peter Penz wrote:
> On Tuesday, 18. August 2009 00:20:47 Matthew Woehlke wrote:
>> While you're looking at this, any chance of fixing natural sorting where
>> it is currently broken?
>> Specifically, sorting of hexadecimal or other
>> base-greater-than-10 numbers? (I have at least one directory of stuff
>> that is base-36 numbering, that sorts very wrongly. Actually, this makes
>> something of an argument for per-directory options...)
> 
> Natural sorting is not "broken" in this case. There is no way for the compare 
> function to know the semantics of a string: Should F1.jpg be handled as a 
> hexadezimal value or not?

I thought of that, which is why I mentioned it needing to be 
per-directory. Nevertheless, I hate to turn off natural sorting 
globally, but it's really hard to find the right file in a list like:

5GH67I
6IF732
6KW84W
7FDM86
8CFUQR
10AH2MF
62DH13
74UZGI
EW5YP
U4H3WM

That's clearly wrong... the order should be:

EW5YP
5GH67I
62DH13
6IF732
6KW84W
74UZGI
7FDM86
8CFUQR
U4H3WM
10AH2MF

(Notice that C sorting is still "wrong" here!)

Hmm... okay, I guess this is almost impossible to solve without user 
input. But it's really, REALLY freakin' annoying in file dialogs; the 
list is all but useless in such cases.

In the example above, C sorting would be okay since I usually know the 
name of what I am looking for, so I can look for "1A..." and it is near 
everything else starting with '1'. (But this is /exactly/ why natural 
sorting is seriously fsck'd here; files starting with '1' end up all 
over the place.)

> I'm really against a per-directory option, as this hexadezimal-example is a 
> corner case for a small group of users which does not justify a user visible 
> UI option "[x] Natural Compare" inside a top-level-menu IMO.

I'd be fine with a hidden option... from your argument, the people that 
would need it are most likely to be comfortable dealing with such an option.

-- 
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
-- 
Some people are like Slinkies... not really good for anything, but they 
still bring a smile to your face when you push them down a flight of 
stairs. -- Gordon Wolfe





More information about the kde-core-devel mailing list