Re: Sorting order for filenames



On Thu, 2005-05-19 at 18:38 +0200, Ole Laursen wrote:
> Hi,
> 
> I recently discovered that filenames are sorted incorrectly when using
> a locale. For instance, you get the sorting
> 
>   event.C
>   eventgenerator.C
>   eventgenerator.h
>   event.h
> 
> both in the file selector and in Nautilus, even in the en_US locale.
> I've reported a bug in GTK+:
> 
>   http://bugzilla.gnome.org/show_bug.cgi?id=172690
> 
> Now, it turns out that the problem can be fixed by making a custom
> collate key generation function (instead of using g_utf8_collate_key).
> I've made one that fixes both the above problem with dots and also
> sorts numbers better, e.g. as
> 
>   file1.txt 
>   file2.txt 
>   file10.txt 
> 
> The algorithm sorts files with small basenames before files with large
> basenames and small numbers before large ones. The cleanest solution
> seems to be to put the function in glib, but it was suggested in the
> above bug report that I asked here first for comments on the sorting
> algorithm. An implementation of the algorithm as a patch for GTK+ 2.6
> for testing purposes is attached to the bug report.
> 
> So what do you think?

I agree. This is a very good idea.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a war-weary small-town card sharp fleeing from a secret government 
programme. She's a time-travelling renegade doctor in the wrong place at the 
wrong time. They fight crime! 




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