Natural Order Sorting

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
JackFoo
Senior Member
Senior Member
Posts: 373
Joined: 2003-02-05, 19:53 UTC
Location: ERROR

Post by *JackFoo »

Actually compare_strnatcmp() wraps strnatcmp()
I know that.
This link IS helpful; (If I wanted to implement it, which I don't, but Christian seems to... )

Cheers.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

JackFoo wrote:This link IS helpful; (If I wanted to implement it, which I don't, but Christian seems to... )
Already ddofborg gave this link in the very first post of this topic and it is repeated in my code.
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Panos,
What worries me though in the plug-in approach is the level of integration with TC and how well the shorting plug-in will interact with file managing actions.

I wanted to say that the ideal solution would be through a Filesystem plugin which would do nothing else but sort using NAT. But as Christian already expressed his interest I think we can drop the plugin idea and look forward to the next TC version.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Spaghettificus
Junior Member
Junior Member
Posts: 17
Joined: 2003-02-11, 19:11 UTC
Location: Columbus, OH, USA

Post by *Spaghettificus »

A new plugin type doesn't sound bad to me. However, I don't need a new plugin type.
Multi-rename will solve the natural order problem!.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50486
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for the link, the file
http://sourcefrog.net/projects/natsort/strnatcmp.c
is just what I needed! And it's even free to use in commercial tools! I will certainly add it. I'm not yet sure how I will implement the user interface - either a checkbox or just a switch in wincmd.ini.
Author of Total Commander
https://www.ghisler.com
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Christian,
I'm not yet sure how I will implement the user interface - either a checkbox or just a switch in wincmd.ini.

My idea would be switching the sort order using Ctrl-F1 when in Brief (or Ctrl-F2 in Full) and indicating the current order for instance by showing "(nat.)" next to the Name column header (like "Name (nat.)").

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
pdavit
Power Member
Power Member
Posts: 1529
Joined: 2003-02-05, 21:41 UTC
Location: Kavala -> Greece -> Europe -> Earth -> Solar System -> Milky Way -> Space
Contact:

Post by *pdavit »

Hacker wrote:My idea would be switching the sort order using Ctrl-F1 when in Brief (or Ctrl-F2 in Full) and indicating the current order for instance by showing "(nat.)" next to the Name column header (like "Name (nat.)").
I like the shortcuts idea but the use of the (nat.) bit next to the Name tab is even better, very practical, clear to the user and I guess easy to implement! ;)
"My only reason for still using M$ Window$ as an OS is the existence of Total Commander!"
Christian Ghisler Rules!!!
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

Hacker wrote:My idea would be switching the sort order using Ctrl-F1 when in Brief (or Ctrl-F2 in Full) ...
I would also appreciate the possibility to quickly change from "sort by name naturally" to "sort by name" (normally, lexically). This could be achieved by adding a command such as cm_ToggleSortByNameMode which would affect the commands cm_SrcByName, cm_LeftByName and cm_RightByName.
The shortcut keys mapped to cm_ToggleSortByNameMode by default (if at all) are secondary. I think it is more important to make the feature visible to every user by adding an appropriate entry in the default Show menu.
Hacker wrote:... and indicating the current order for instance by showing "(nat.)" next to the Name column header (like "Name (nat.)").
I agree.

REVISION: After thinking it over I changed my mind. :arrow: Please see my post below.
pdavit wrote:I like the shortcuts idea but the use of the (nat.) bit next to the Name tab is even better, very practical, clear to the user and I guess easy to implement!
On the one hand adding a checkbox next to the Name column header would be practical. It would even allow to set the "name sort mode" for the right and the left window independently. On the other hand I guess it costs considerably more to implement and it would look a bit ugly and crowded.
Last edited by jb on 2003-05-22, 17:23 UTC, edited 1 time in total.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50486
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Just for your info, I have now added natural sorting to TC. The above code wasn't quite what I expected (too simple), so I wrote my own. I will consider a method to change the sort type quickly.
Author of Total Commander
https://www.ghisler.com
User avatar
pdavit
Power Member
Power Member
Posts: 1529
Joined: 2003-02-05, 21:41 UTC
Location: Kavala -> Greece -> Europe -> Earth -> Solar System -> Milky Way -> Space
Contact:

Post by *pdavit »

ghisler(Author) wrote:Just for your info, I have now added natural sorting to TC. The above code wasn't quite what I expected (too simple), so I wrote my own. I will consider a method to change the sort type quickly.
To quote Belinda: Ooooo, haven is a place on earth!

Thanks Christian!

What’s your address again? I wanted to send those flowers or more manly… a shaving kit! ;)
"My only reason for still using M$ Window$ as an OS is the existence of Total Commander!"
Christian Ghisler Rules!!!
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

BTW: Does this natural sorting also apply to file names when sorting by extensions? (I hope yes.)

TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

ghisler(Author) wrote:Just for your info, I have now added natural sorting to TC.
Great, thanks! :D
ghisler(Author) wrote:The above code wasn't quite what I expected (too simple), so I wrote my own.
Also the coding style may not satisfy everyone, but nevertheless I'm grateful for strnatcmp.c because it is available, freely usable and it inspires others like you. I think this little example nicely shows the power of Open Source.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

Hacker wrote:... and indicating the current order for instance by showing "(nat.)" next to the Name column header (like "Name (nat.)").
I don’t agree any more because I imagine that many users (including me) will use the natural sort mode most of the time and I prefer clean column headers. A suffix such as " (nat.)" gets annoying in the long run. I see the following alternatives to indicate the current sort mode for name sorting:
  1. No suffix, but a menu item such as "Natural Sort Mode" with/without a check in the "Show" menu, for instance directly above or below the "Name" item.
    So in the rare case when it's necessary to verify the sort mode the info is just a click away (or two key strokes). Of course the "Natural Sort Mode" item would not only be an indicator, but also a toggler.
  2. No suffix, but a ToolTip associated with the "Name" column header saying for instance "Natural Sort Mode is on".
  3. A decent suffix such as " *" or a little icon.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

Hacker wrote:BTW: Does this natural sorting also apply to file names when sorting by extensions? (I hope yes.)
Yes, I hope so too! Furthermore natural sorting could be applied to the extensions themselves because they are strings too. Sometimes I append an index to temporary backup files. Example: a.doc.1, a.doc.2 ... (although more often a-1.doc, a-2.doc ...).
Actually "sort by name" should mean "sort by (name, extension)"
and "sort by extension" should mean "sort by (extension, name)".

PS: Which fields are actually used as tie-breakers when sorting by date or by size? It could always be (name, extension) because this combination is guaranteed unique and name is the most important field.
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

jb,

I imagine that many users (including me) will use the natural sort mode most of the time and I prefer clean column headers. A suffix such as " (nat.)" gets annoying in the long run.

I disagree. IMO it would be much more annoying having to get into a menu to see how things are sorted. I personally would prefer to have it at a glance. Tooltip would mean having to grab the mouse, point precisely and wait a short time just to see the info, then get the mouse out of the way. A * next to the name might be much more confusing - users will definitely ask what it means, probably thinking it's the currently applied filter.
My opinion.


Which fields are actually used as tie-breakers when sorting by date or by size? It could always be (name, extension) because this combination is guaranteed unique and name is the most important field.

BTW: In the old forum I think there was a short thread about being able to define the sort order, even for specific dirs (e.g. c:\downloads\ by Date, Ext, Name, Size). Chrisitan hasn't expressed his opinion on this matter IIRC.

HTH
Roman
Post Reply