atom / tree-view

🌳 Explore and open project files in Atom
MIT License
561 stars 364 forks source link

Sorting doesn't work properly #814

Open alexandernst opened 8 years ago

alexandernst commented 8 years ago

"screenshot"

I'd expect folders to be sorted alphabetically (as they do in upper directories), but for some reason the assets folder in a Yii2 framework project is making the sorting behave in a strange manner.

thomasjo commented 8 years ago

Are you able to reproduce this in safe mode? I just want to rule out the possibility this is somehow caused by a community package or some such.

alexandernst commented 8 years ago

@thomasjo Yes, this also happens with --safe. In fact, this is as easy to repro as creating 3 folders:

a61c7cb
a69e85b9
a6264eb9
lee-dohm commented 8 years ago

This is most likely caused by the natural sorting algorithm added in https://github.com/atom/tree-view/pull/621. It may need to have an exception added for hexadecimal numbering?

alexandernst commented 8 years ago

Were you able to repro this bug? Do you need me to provide further info?

winstliu commented 8 years ago

Confirmed on Windows 10 x64, Atom 1.9.0-dev-6b31780.

The folders are displayed in the same order as in @alexandernst's comment.

winstliu commented 8 years ago

I'm seeing similar behavior in Windows Explorer: explorer

ghost commented 4 years ago

Hi. I am running into the exact same issue: filenames containing hex numbers get mixed up. Natural sort algorithm is a good thing. It just doesn't work with hex numbers.

Why? The algorithm can't know whether we are using decimal numbers and revisions, or hex numbers. Example:

DEC NOs & REVs      HEX NOs
(correct sorting)   (incorrect sorting)
=================   ===================
chapter01.doc       mem_bank_01.asm
chapter01a.doc      mem_bank_1A.asm
chapter1b.doc       mem_bank_1B.asm
chapter2.doc        mem_bank_02.asm
chapter09.doc       mem_bank_09.asm

So in my particular project I would like the right column to be sorted correctly. The particular commit (#621) tells us:

The commit also adds an option to use the old sort function, incase this one doesnt work with other locales, or if users prefer posix style sorting.

Yea, that's me, thank you! ;-) I can't find the option however. I might be looking at the wrong place. FYI: I was expecting to find it somewhere over here:

afbeelding

Kind regards!