Page 1 of 1

Sorting seems broken

Posted: 03 Feb 2012 22:42
by gruia
My folder sorting seems broken it places 4.5 before 4

Re: Sorting seems broken

Posted: 03 Feb 2012 22:51
by j_c_hallgren
gruia wrote:My folder sorting seems broken it places 4.5 before 4
That's a very vague comment...needs much more details...like the entire file names involved and what sort related options you may be using.

Re: Sorting seems broken

Posted: 03 Feb 2012 23:06
by gruia
~ [3.0] Equus (1977) of the sort

can you tell me what kind of settings you are looking for?
are you not able to reproduce it?

I've tested a bit, it seems the [ ] are the cause

do you have an explanation?

Re: Sorting seems broken

Posted: 04 Feb 2012 03:09
by nas8e9
gruia wrote:~ [3.0] Equus (1977) of the sort
Could you post at least two file names, preferably in a Code block?
gruia wrote:can you tell me what kind of settings you are looking for?
I'm guessing at least your Windows version, bitness and language settings, as well as your XYplorer version and sort settings (as set in View > Sort By, as well as in Configuration > General > Sorting).

Re: Sorting seems broken

Posted: 04 Feb 2012 03:34
by FeatureCreep
Hi, gruia, the developer and blog masters here are very good at giving prompt replies but they're not mind readers. :) Supplying a list of filenames sorted in the order that was troubling you (and the version of Windows you are using) would have been more helpful.
e.g.
Go to the relevant folder
Click the name column header to sort by name
Click menu items
Edit > Select > Select All Files
File > To Clipboard > Item name(s)
Paste your file list and post it here (XYplorer always copies files names in the order they are displayed in the file list when copied).

Anyway, I think I found what your problem is (but it took some guesswork).

Number sequences with a decimal point and enclosed in square brackets are not sorted optimally.
e.g.
[1] mmm.txt
[4.5] mmm.txt
[4] mmm.txt
[11] mmm.txt

4.5 comes before 4, which is not the normal way
e.g.
1 mmm.txt
4 mmm.txt
4.5 mmm.txt
11 mmm.txt
mmm.txt
mmm 1.txt
mmm 4.txt
mmm 4.5.txt
mmm 11.txt

[Incidentally: The above is also the case in Windows Explorer except that WE places mmm 1.txt before mmm.txt.]

The above examples were with the following XYplorer options checked ON
Tools > Configuration > General > Sorting > Natural numeric sort order
and
Tools > Configuration > General > Sorting > Sort file names by base
Also using Win7 (XP may behave differently).

You could make a feature request for sorting of numbers enclosed in square brackets to be handled differently, but I suspect that changing the sort algorithms is not trivial. Or you could:

Select all files
click
File > Rename Special > Search and Replace
and enter the following in the text box
[]>>()

-to replace all square [] brackets with regular () ones.

They don't seem to affect the sort order. :)

(1) mmm.txt
(4) mmm.txt
(4.5) mmm.txt
(11) mmm.txt

Hope this helped.

Re: Sorting seems broken

Posted: 04 Feb 2012 04:47
by j_c_hallgren
FeatureCreep wrote:Hi, gruia, the developer and blog masters here are very good at giving prompt replies but they're not mind readers. :) Supplying a list of filenames sorted in the order that was troubling you (and the version of Windows you are using) would have been more helpful.
Yup! So true!
Anyway, I think I found what your problem is (but it took some guesswork).
When the post with the brackets was made by gruia, that somewhat confirmed my theory but thanks much to FeatureCreep for the detailed followup! 8)

So I just now looked up in an ASCII table and see that the [ and ] are x5B and x5D while () are down at x28/x29 and period is x2E so those are all less than numerics of x30-x39...thus when the length of data within the brackets varies, sort issues will occur...if all were of the form [xx.xx], then it should work but not with mixed [x] and [x.x]...make sense?

Re: Sorting seems broken

Posted: 04 Feb 2012 10:16
by gruia
I know this, as I am using it as workaround :)

now all my list is [3.0] and [3.5] instead of [3.5] and [3]

So fixing this won't affect me too much, just bringing it to your attention

Good luck

Re: Sorting seems broken

Posted: 04 Feb 2012 10:24
by admin
"Natural numeric sort order" is done by a Windows function. It will be fixed when "they" fix it.