id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
1860	Unwanted natural sorting of numbers in file panels	Wiseman1024	andrew_b	"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.

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"").

I'm experiencing this problem in both Debian sid on i686 and Ubuntu Hardy on AMD64, with both Midnight Commander 4.7.0-pre1-3 from the Debian sid repository and Midnight Commander 4.7.0-pre4 compiled from source. Both systems are similar in setup. Here's information for one of them:


# uname -a
Linux Zohar 2.6.31-1-686 #1 SMP Sun Nov 15 20:39:33 UTC 2009 i686 GNU/Linux

# cat /etc/issue
Debian GNU/Linux squeeze/sid \n \l

# dpkg -l mc libglib2.0-0 libslang2 | tail -3
ii  libglib2.0-0                                 2.22.2-2                                     The GLib library of C routines
ii  libslang2                                    2.2.1-1                                      The S-Lang programming library - runtime version
ii  mc                                           2:4.7.0-pre1-3                               midnight commander - a powerful file manager

# locale
LANG=en_US.UTF-8
LC_CTYPE=""en_US.UTF-8""
LC_NUMERIC=""en_US.UTF-8""
LC_TIME=""en_US.UTF-8""
LC_COLLATE=C
LC_MONETARY=""en_US.UTF-8""
LC_MESSAGES=""en_US.UTF-8""
LC_PAPER=""en_US.UTF-8""
LC_NAME=""en_US.UTF-8""
LC_ADDRESS=""en_US.UTF-8""
LC_TELEPHONE=""en_US.UTF-8""
LC_MEASUREMENT=""en_US.UTF-8""
LC_IDENTIFICATION=""en_US.UTF-8""
LC_ALL=


I've verified my system's strcoll function orders strings as expected (i.e. strcoll(""a10"", ""a3"") returns -1)."	defect	closed	major	4.7	mc-core	4.7.0-pre4	fixed	sort order collation numeric numbers					
