Sorting numbers as text AND as digits

by Michael S. Kaplan, published on 2006/12/12 03:01 -05:00, original URI:

It's funny, but the past few years whenever I have had to fly I have noticed (whether sitting in my scooter or sitting in a wheelchair) that people in the airport are really not paying very much attention where they are going. I m not sure what it is, but people kind of turn off the part of their brains that pays attention to details.

People are the same way when they use their computers, I think. So most people may not have noticed the kind of thing this post is about.... 

As much as the Shell tries to do everything that it does in a consistent way, the little things get in the way.

Like let's take sorting numbers as digits rather than as text, as discussed in What is up with number sorting? and other posts.

So I am in Vista with some text files designed to arbitrarily and unrealistically show off the feature:

Now we already know that the Command Prompt won't handle things the same way:

But if you look at some other pieces that the Shell provides like the File Open dialog (seen here in Notepad) you can see it looks like StrCmpLogicalW is being used again:

But if you try to start typing in file in the File name text box and then wait for a second, you see the sorted list of files:

Looks like your average everyday listbox with the LBS_SORT style on it, so that when LB_ADDSTRING is called something like a bunch of calls to lstrcmpW or lstrcmpiW happen to support some kind of insertion sort. So you have a list of files in the listbox that is not in the same order as the list in the listview

It is of course also possible that no one noticed this kind of thing (like most minor inconsistencies like this, I found it by accident).

I think most people do not spend much time paying attention to the Shell, even if they constantly use it. It's like they are at the airport or something, bumping into my scooter. :-)


This post brought to you by  (U+0ed6, a.k.a. LAO DIGIT SIX)

# WebmasterX on 12 Dec 2006 6:27 AM:

What a silly post.  I would wager that this inconsistency is 100% done on purpose.  When you are browsing for a file you want them organized in true alphabetical order.  When you are typing a file name to save / rename / search for a file the sorting is in the other format because it's the only one that makes sense.

# tzagotta on 12 Dec 2006 9:05 AM:

Interesting - didn't notice that Vista's shell sorted in that way. Too bad that rename is still strange. It would be nice to, in your example, select all the files, hit F2, and then change "file" to "text" and have Vista keep all the existing numbers. Instead, Vista (and XP) do a rename using a style that probably doesn't do what anyone would expect - violating the principle of least surprise.

# Michael S. Kaplan on 12 Dec 2006 9:23 AM:

Actually WebmasterX, that isn't the case. It is just the autocomplete stuff is not tuned to using StrCmpLogicalW.

One of the devs pointed out that there are other problems here as well, which I sill point out in another post....

# Michael S. Kaplan on 12 Dec 2006 9:25 AM:

Hi tzagotta,

The multiple rename suffers from a different problem -- that there are multiple "intuitive" options as to how it should work, all of whcih are mutually contradictory....

# tzagotta on 12 Dec 2006 9:35 AM:

I agree that there are multiple possible interpretations, but the current approach of picking one that is wrong for most people most of the time is not the right approach. If there are a number of possible ways to do that, then there needs to be an option, either a static option, or a probably better - dialog box that comes up during the rename process, that allows the user to choose what they want if there are multiple possible ways.

And in the example you gave and I built on, I think that renaming in that case is pretty clear. Do you see different reasonable interpretations when the user just changes the "words part," leaves alone the "numbers part," and has selected a bunch of files that have the same "words part" and different "numbers parts"?

I agree it is a little complex and that it would require some thinking and some user research, but the OS is at the point now where it can start to address more complex usability scenarios like this. This functionality should be part of the OS, and not require that I load a "rename utility" just to get that functionality (many exist today).

Also, to a certain extent, I agree with WebmasterX - the incremental search would be a little strange if the entries were sorted the same way the shell does, right?

# Michael S. Kaplan on 12 Dec 2006 10:43 AM:

Well, perhaps on WebmasterX's point -- though the difference is stark enough to seem like a mistake, like people at Microsoft don't talk to each other. :-)

For the other, I think the Shell folks are kind of in transition now as far as features like this -- first steps have been taken, now they have to take the next steps. There are risks to including too many options, but there are definitely rewars to making a decision and going with it....

# NBC on 12 Dec 2006 11:24 AM:

i don't use the shell :) i use totalcmd :p

# Maurits [MSFT] on 12 Dec 2006 11:47 AM:

I find this feature unbelievably annoying, but I have to deal with large lists files whose names are GUIDS or other hex number strings.  It's much easier to find any given hex number if they're sorted in hex order, which is alpha order; this alpha/numeric order does strange things to the brain for lists of hex.

# Heath Stewart on 12 Dec 2006 1:35 PM:

Yeah, foot traffic in the airport annoys me, too - actually, pretty much anywhere. In this country - and a few others - people drive on the right. In other countries the left. I believe foot traffic should follow the same practice as the country you're in jst like is expected when driving a rental or something.

If everyone stays on the same side when going a particular direction - until you need to turn - everything would run smoother. But when people walk all over the place - even at angles going back and forth like they wre served too much on the last flight - it just makes it a pain for everyone else. I can imagine that in a wheel chair or scooter this would be abigger pain because you can't exactly jump out of the way (although it should be easier to plow them over!).

# raz on 17 Dec 2006 8:33 AM:

windows stores and sorts albums of media content into folders based on name, so the first in a series of albums (music or movie) will be sorted out of order thus:

austin powers 2

austin powers

(in both the file system and media Player). manually fixing this to be "austin powers 1" will not work if media player is automatically updating the string from the online database, as it will rename this back to "austin powers".

# Michael S. Kaplan on 17 Dec 2006 1:28 PM:

Hi raz ---

Yes, that is why the Vista changes I described here are so cool. :-)

# raz on 12 Jan 2007 8:21 AM:

it might be cool on vista, but that means moving to the latest version (v11) of media player and the library in that is a crippled version of the v10 library on XP. one small step forward for sorting, ten big steps backward for managing your media library. that's enough for me to avoid moving to vista

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2007/01/18 What the %$#& is up with localized paths in Vista?

go to newer or older post, or back to index or month or day