Sorting seems broken

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
gruia
Posts: 7
Joined: 08 Jan 2012 00:46

Sorting seems broken

Post by gruia »

My folder sorting seems broken it places 4.5 before 4

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Sorting seems broken

Post 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.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

gruia
Posts: 7
Joined: 08 Jan 2012 00:46

Re: Sorting seems broken

Post 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?

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: Sorting seems broken

Post 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).

FeatureCreep
Posts: 162
Joined: 02 Dec 2011 21:18

Re: Sorting seems broken

Post 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.
Last edited by FeatureCreep on 04 Feb 2012 08:16, edited 1 time in total.

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Sorting seems broken

Post 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?
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

gruia
Posts: 7
Joined: 08 Jan 2012 00:46

Re: Sorting seems broken

Post 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

admin
Site Admin
Posts: 65535
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Sorting seems broken

Post by admin »

"Natural numeric sort order" is done by a Windows function. It will be fixed when "they" fix it.

Post Reply