sort by name behavior

Bug #1548047 reported by Eka Cahya Pratama
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Files
Opinion
Wishlist
Unassigned

Bug Description

when files sorting the files by name, the rule used is a-z then A-Z then other character. It should be other character first(like [ ] and other) then 0-9 A-z (uppercase and lowercase didn't matter, the matter is alphanumeric order).

problem example : https://drive.google.com/file/d/0B-XJFggOR3mGZUJRTkJ0NlJFcnM/view?usp=sharing

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Files uses the GLib.File function "collate_key_for_filename ()" to determine the sort order, once special cases (e.g. folders. hidden files) are taken into account. Presumably a custom function could be used if there is enough support for this proposal.

Changed in pantheon-files:
importance: Undecided → Wishlist
Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

The current sort behaviour is to sort alphanumerically, ignoring case and ignoring leading special characters. Filenames consisting only of special characters sort first. So sorting on name gives this order for example:

[[[
]]]
111
999
aaa
[[[aaa]]]
AAA
abc
nnn
NNN
z
<z>
zzz

This seems pretty much as the bug reporter wants, except that leading special characters do not affect sort order.

Changed in pantheon-files:
status: New → Opinion
Revision history for this message
Eka Cahya Pratama (ekapratama93) wrote :

yep, special character and also Uppercase/lowercase problem. I read about this problem and many people suggest to use so called "natural sort order" or "alphanumeric order". You could take a look at this beautiful post by Jeff Atwood (http://blog.codinghorror.com/sorting-for-humans-natural-sort-order/) and Kay Rhodes (http://weblog.masukomi.org/2007/12/10/alphabetical-asciibetical/). Also I have checked some list order code by David Koelle (http://www.davekoelle.com/alphanum.html). It's great code but may still need a little tweaking with the uppercase and lowercase problem.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

OK, thanks Eka - I understand the issue better now. The collate_key_for_filename () function that Files uses does do a "natural sort" of kinds at least rather than a simple ascii sort. For example foo2 sorts before foo15. Could you confirm again, with example pairs of filenames, where Files sorts incorrectly on name? It would be preferable if you use the latest version (r2143) but you would have to download and compile it yourself from https://code.launchpad.net/pantheon-files

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.