Wrong sorting of files and directories with "-" (minus) in name

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
susla
Junior Member
Junior Member
Posts: 4
Joined: 2020-01-10, 22:04 UTC

Wrong sorting of files and directories with "-" (minus) in name

Post by *susla »

Wrong sorting of files and directories with "-" (minus) in name
example - files sorted in TC9.50b12 by filename or extension
aaaa.txt
-aaaa.txt
aabb.txt
bbbb.txt
-bbbb.txt
cccc.txt
-cccc.txt
dddd.txt
eeee.txt

"-????.txt" files should be grouped.
User avatar
Dalai
Power Member
Power Member
Posts: 9389
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Wrong sorting of files and directories with "-" (minus) in name

Post by *Dalai »

Are you aware of the different sort methods TC provides? You can change the sort method in Configuration > Options > Display > Sort method.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
susla
Junior Member
Junior Member
Posts: 4
Joined: 2020-01-10, 22:04 UTC

Re: Wrong sorting of files and directories with "-" (minus) in name

Post by *susla »

Oh, my fault. I did not notice this choice in the menu.
Sorry for the fake bug report.
susla
Junior Member
Junior Member
Posts: 4
Joined: 2020-01-10, 22:04 UTC

Re: Wrong sorting of files and directories with "-" (minus) in name

Post by *susla »

There is still a problem with the correct sorting of letters with accents in my language (Czech) at the same time as the "-" letter, but switching the sorting options can solve it.
I tried all settings.
"Alphabetical, considering accents" - correct sorting of characters with accents, but problem with "-".
"Natural sorting: alphabetical and numbers" anad both "charcode sorting" - correct grouping names with "-", but wrong sorting of characters with accents.
If merged option "Alphabetical, considering accents + Natural sorting: alphabetical and numbers" were to exist, it would solve this problem altogether.
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Wrong sorting of files and directories with "-" (minus) in name

Post by *petermad »

2susla
It seems to be a special problem when prefixing with "-" - if you use other characters like "_", "+" or " " (space) - the sorting is grouped according to the prefix character...

See: https://madsenworld.dk/tcmd/accentsorting.png

Notice that certain accented characters are sorted differently under different locales - that is why ä is sorted after æ and ö is sorted after ø in the screenshot, because ä and ö are considered subtypes of æ and ø in Danish.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
susla
Junior Member
Junior Member
Posts: 4
Joined: 2020-01-10, 22:04 UTC

Re: Wrong sorting of files and directories with "-" (minus) in name

Post by *susla »

Yes, it is exactly as you wrote, special problem when prefixing with "-" in languages with accents.
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Wrong sorting of files and directories with "-" (minus) in name

Post by *petermad »

The "Natural sorting: alphabetical and numbers" is the same sorting as in Windows Explorer and if I recall corretcly: TC uses Windows functions for this sort method, so there is probably not much to do about it.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Wrong sorting of files and directories with "-" (minus) in name

Post by *ghisler(Author) »

It seems to be a misfeature of the "Natural sorting" function StrCmpLogicalW, which sorts numbers by their value instead of sorting them althabetically, e.g. 99 comes before 100. I guess that it sees the "-" as a negative sign, and therefore ignores it.
Author of Total Commander
https://www.ghisler.com
Post Reply