Re: Unwanted natural sorting of numbers

I'm using Midnight Commander 2:4.7.0-pre1-3 from the Debian testing package on AMD64. Maybe it's something introduced by a Debian patch, or maybe it's something new in version 4.7.0?

2009/12/2 Milan Cermak <Milan Cermak sun com>
Which version of midnight commander are you using?
I don't see such behavior on 4.6.1.

Milan Cermak

Dne  2.12.09 17:11, Miguel Pérez napsal(a):

   I've noticed when Midnight Commander sorts filenames alphabetically, it treats numbers specially as to sort filenames "a1", "a3" and "a20" in this order, contrary to the expected "a1", "a20", "a3" order provided by most if not everything else (examples I had readily available: ls, sort, Konqueror file manager, KDE file chooser, Opera's file chooser, Python's sorted(os.listdir('.'))). As a reference, FAR Manager sorts like everything else too. It's just Midnight Commander the one sorting weirdly. (I'm using the "C" collation locale, although as far as I understand this is not dictated by locales.)

   While this may look nice on the basis that the number 3 comes before the number 20 and so on (when treated as such!), this is extremely irritating because almost everything else will sort files correctly and contradict Midnight Commander's file sorting. It's even dangerous, as it may lead to user confusion and mistakes that could derive in data loss. Allow me to explain my particular case as an example: I use Midnight Commander as my central file management tool. However, in order to view image files, I've associated my own image viewer with the F3 (view) action for image files. This image viewer allows me to walk forwards and backwards within the directory starting from the file I used to open it, so for example I'm in a directory with files "a1.png", "a3.png" and "a20.png" as seen in Midnight Commander. I hit F3 on "a1.png", and then go forwards to the next file expecting to view what was next in Midnight Commander - "a3.png"; however the image viewer (and any other application I have) will jump to "a20.png" if they're alphabetically sorting files. I may then see something I don't like, and decide to delete the next file to the one I started browsing, so when I'm back to Midnight Commander I go and delete the wrong file ("a3.png").

   Could you implement an option to disable this kind of "user-friendly" natural sort algorithm that could easily backfire on users and end up being unfriendly?



Mc-devel mailing list

The amount of things I don't know is enormous.
But I'm grateful for every bit of information.

Antes de imprimir este correo electrónico, considera tu responsabilidad medioambiental.

Please consider your environmental responsibility before printing this email.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]