Consistency in the Windows Shell is not overrated; it's just underobserved!

by Michael S. Kaplan, published on 2008/03/04 10:16 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2008/03/04/8015052.aspx


Please read the disclaimer; content not approved by Microsoft!

You may have been around in January 2005, when I first answered the question What is up with number sorting?.

On the other hand, perhaps you were around in April 2005, when I said a bit more on the subject in What is up with number sorting, redux.

Perhaps you missed both and your first introduction to the subject was in October 2006, when I talked about the Logical StrCmpLogicalW changes in Vista.

All of them center on the StrCmpLogicalW function, created by the Shell folks to help with a more intuitive sorting behavior for normal humans (which excludes geeks, who are not normal).

Of course I do not refer to the initial implementation with its not so great bug long since fixed everywhere, though technically that was due to the not very intuitive nature of integer overflow bugs to people who had never seen them before! The fixed version of the code is much smarter than both the original and the upstarts in this area I mentioned recently in Incomplete Scenarios: They don't know everything that's up with number sorting!

To know if you are normal, look at the following:

If you think the order looks correct, then you are not a normal human -- because all normal humans know that

6 < 55 < 444 < 3333 < 22222 < 111111

Anyway, Vista is tailor made for normal humans! See?

Look at that! It knows which numbers are bigger!

Or wait, maybe not -- look at what we see in the address bar:

Crap.

I guess some parts of the OS user interface aren't calling StrCmpLogicalW. :-(

Ah, but there is hope here!

Check out the breadcrumb bar:

Yea! Some parts of the OS user interface are calling StrCmpLogicalW after all!

That's a relief, let me tell you.

Oh wait, I may have spoken too soon. When it's files the OpenFile dialog has trouble too:

Crap again.

Oh well, there is always next version, right? :-)

There are almost certainly other cases of this problem, with parts of the OS that don't call StrCmpLogicalW, even in Vista.

Can you find examples of your own of this problem, in Vista?

I'll talk about other inconsistencies another day....

 

This blog brought to you by(U+0ec2, aka LAO VOWEL SIGN O)


# Mihai on 4 Mar 2008 1:05 PM:

My guess: the two bad places are probably using the standard history feature of the standard combo-box. That is the one that should be fixed.

I can understand the difficulties a developer has to solve to reconcile the differences between breadcrumb bar and address bar.

The address bar is "the real thing" and is less aware of fancy stuff.

Kind of the same problem with "fake translations" done with SHSetLocalizedName (try navigating "My Music" or "My Documents" with MUI).

# John Cowan on 4 Mar 2008 1:10 PM:

It's not so much whether StrCmpLogicalWhatever is called, it's the fact that it obviously can't cope with the presence of more than one numeric part in the strings you hand it.  So while 6 sorts before 16, making foo\6 sort before foo\16 requires more sophistication -- and to get the order of 6\6, 6\16, 16\6, and 16\16 right involves working even harder.  And so on.

# Ben Cooke on 4 Mar 2008 1:18 PM:

How does it handle mixtures of digits and letters, though? (I ask only because I don't have a Vista box here to test with.) I'm thinking of lists like "Version 3.0 (draft)", "Version 11 (released)", "Version 87.2 2006-04-28".

The autocomplete thing has several other interesting issues other than that ordering problem you've seen. The one that bites me most often is that in a common file dialog box with a filename extension filter set, the autocomplete list will show all files ignoring the filter. This can be especially irritating when combined with a long filename that doesn't fit in the box so you can't actually tell the difference between various versions of the same file with different extensions.

I think the geeky sorting is the least of the autocomplete widget's problems! :)

# Michael S. Kaplan on 4 Mar 2008 1:26 PM:

Hi John,

It actually does handle thiose cases quite well, believe it or not -- when it is called. :-)

# Michael S. Kaplan on 4 Mar 2008 1:28 PM:

Good point, Ben -- I was just focusing on the one inconsistency but there are other problems in some of the pieces here....

# Dean Harding on 4 Mar 2008 5:27 PM:

It also doesn't sort "normally" when displaying files in a menu (for example, the "Send To" menu, the quicklaunch menu, etc). See:

http://codeka.com/blogs/media/unintuitive-sort-1.png

and

http://codeka.com/blogs/media/unintuitive-sort-2.png

# Maurits [MSFT] on 7 Mar 2008 3:35 PM:

Question... of the places that /do/ call StrCmpLogicalW, how many honor the "no, really, I'm a geek" policy?

(HKCU|HKLM)\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoStrCmpLogical

# Michael S. Kaplan on 7 Mar 2008 4:13 PM:

I would guess all of them? I think the functionality is built into the function, right?

It would be easy enough to check....

# Michael S. Kaplan on 7 Mar 2008 6:28 PM:

Nope, looks like it does not. Though it does pick up the Vista "dot" behavior improvement based on that other polcy!

trodas on 29 Sep 2009 5:22 PM:

And is there a way to change the sorting behaviour? I mean... not waiting for new version of Windows, but fixing it "in the place", modificating the way the sorting works, perhaps?

Anyone? :)


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

2008/06/10 When Unicode's "PDF" character isn't supported, you really *can* say that the app's Bidi support doesn't POP!

2008/03/13 More than one kind of "alphabetical" order

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