Unwanted natural sorting of numbers



Hello,

    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?

Thanks


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