Search: If It Isn't Incremental, It's Excremental

October 31, 2005

After I discovered the CTRL+I incremental search function in Visual Studio, I never used the standard find dialog again. Incremental search is so good that it makes traditional search dialogs completely obsolete. If you think that's hyperbole, consider that Chris Sells calls incremental search "pure sex".

This particular find dialog is from Notepad, but it's the basically the same find dialog that appears in every Windows application:

Standard search in Microsoft Notepad

The delimited search dialog has a lot of problems:

  • It's a dialog. A dialog right smack dab in the middle of the text, potentially obscuring what you're searching for. In some apps it's even modal!
  • It provides very little feedback. There's no indication whether your search term matches anything until you type the complete search term and press return or click Find.
  • It's an all-or-nothing operation. Once you initiate a search, you're committed until the search completes. If you just mistyped a search term in a 5 megabyte text file, have fun waiting for that to complete.
  • It forces you to think about directionality. If your cursor happens to be near the bottom of the file, you may not find any matches even though some exist at the top of the file. And you get nagged with yet another "no matches found" dialog.

Jef Raskin, in his book The Human Interface, has some choice words for the delimited search dialog:

This traditional method is rather punishing to the user, although most computer aficionados have become so accustomed to it that they no longer feel the pain.

Now compare that Notepad search dialog with the incremental search in Firefox:

Incremental search in Firefox

The advantages of incremental search are numerous:

  • There aren't any dialogs in your way. The search interface is blissfully dialog-less. There's nothing getting in the way of you and your search results. You can search, find, and resume working with minimal interruption. This is arguably handled even better in Visual Studio, where the interactive search indicator is a cursor change after you press CTRL+I.
  • It wastes less of your time. The search begins as soon as the first character is typed. You know immediately when you've got a good enough match and you can stop typing.
  • Mistakes are clearly evident. If you mistype something, you'll know that immediately, too. Press backspace to correct the typo and you're back to the previous match.
  • It's interactive. Immediate search feedback alows you to adjust your search strategy in real time. The net result is far better searches than you'd ever get from a traditional OK-then-try-again dialog box cycle.

After you've worked with incremental search for a few hours, you'll probably wonder why incremental search isn't included as a standard feature in every single Windows application. As Jef Raskin notes:

From the point of view of interface engineering, the advantages of incremental searches are so numerous and the advantages of delimited search so few that I can see almost no occasions when a delimited search would be preferred.

Jef also adds an amusing footnote to that sentence: If it isn't incremental, it's excremental. Amen, brother. I can barely stand to use editors without an incremental search mode any more. I'm so glad that (after a little prodding on my part) the latest betas of EditPad Pro 6 include this feature.

Posted by Jeff Atwood
24 Comments

I'd prefer it to be on top and in a different color.

Perhaps you want an IE style "yellow bar"?

http://www.codinghorror.com/blog/archives/000019.html

The IE team gets no love for the one innovation they introduced that Firefox cloned almost instantly.

Jeff Atwood on November 1, 2005 1:09 AM

Interestingly, and typical of its heavyweight, 'belt-and-suspenders' design, the current version of Opera has both a dialog search and and incremental search toolbar. Unfortunately, the default binding for ctrl-F is for the dialog search, but the fact that it has the incremental search is quite appealling. Now if only the browser were more stable under heavy loads...

Joseph Osako on November 1, 2005 1:21 AM

incrememental search has been around for a long time - I'm happy that it's finally found it's way into visual studio.

Vim users have been using it forever. I've been bitching about the standard ctrl+f 'find' dialog for two years - but no one has been willing to venture outside of their IDE for long enough to discover it.

the fact that (as Jef Raskin stated) so many "computer aficionados have become so accustomed to it that they no longer feel the pain" ... is, in my opinion, a contributing factor to the intellectual stalemate faced by the software industry.

brad on November 1, 2005 3:33 AM

Thanks for the tip for Visual Studio. I recently experimentally switched to Firefox (I was using NetCaptor, one of the pioneer multi-browsers on the market that wraps IE) PRIMARILY because of the excellent search functionality. I didn't know this kind of "modeless" search had a name, but it is by far the coolest way to search.

Drazen Dotlic on November 1, 2005 3:55 AM

Spot on post.

Of course, the default search mode in Emacs is incremental, and has been for some time :-)

Gustaf Erikson on November 1, 2005 5:46 AM

oh my. this was built into Progress 4GL as long ago as 1989, when i first started using it.

Buggy Fun Bunny on November 1, 2005 7:17 AM

This is a prime case of MS needing to re-visit existing MS user interface standards.

Mind you the MS office team seems to have taken a long hard look at tradtional office interface wisdom.
I hope the Vista core tools folks do the same.

Peter Bridger on November 1, 2005 7:30 AM

For Visual Studio searching, I also like the mztools search (a 3rd party addin), which presents all the search results in a list (broken down by class and method). You can then clcik each one to go to that result in a code window.

Also has a Find Procedure Callers which does exactly what it says and is super useful.

Simon on November 1, 2005 9:10 AM

Conventional search is handy when searching through multiple files; incremental search in VS.NET seems to be limited to the current file. Also, sometimes it is handy to see a complete list of all the matches, not just the first one, and in that case Visual Studio handles it just right: you get a list of all the matches and clicking on one jumps you to that match. But most apps do this brainlessly and just show you the first one and then you have to keep clicking ok to see the next ones.

Josh on November 1, 2005 10:17 AM

For reasons unknown to me, my VS.net 2003 maps 'incremental search' to Ctrl+Alt+I, not Ctrl+I.

Also - little tip for ya - pressing Ctrl+Alt+Shift+I does a 'reverse incremental search' (or should that be a 'decremental search'? ;)

Andy on November 1, 2005 11:04 AM

On the Firefox downside: the previous search facility could find text in textareas, the incremental search cannot. That's a major bummer when you edit wiki pages :/

Consider that the Firefox incremental search isn't even as feature complete as the age-old one in Emacs: when you enter the string in Emacs, not only do you see your current match, you see all other matches highlighted (in a different color) below and above as well.

This is often _very_ useful if it's a variable or somesuch, and you get a kind of a "preview" if the match wasn't exactly what you thought you looked for. Or if you're browsing a log file where all lines look the same.

And, here's another little UI gem from Emacs' incremental search: when you have started the search, press Alt-w to expand the search string to the current word. Alt-w again to expand the search to the next word, etc.


/J

Johan Lindstrm on November 1, 2005 11:17 AM

The one complaint I have about Firefox's implementation of incremental search is that when I hit CTRL+F5 the first time, I didn't even notice it. I couldn't find the search because it's docked at the bottom in the same color as the status bar. Even now, I get confused as I switch between apps.

I'd prefer it to be on top and in a different color. Perhaps with an option to display a list of matches. But all modeless!

Haacked on November 1, 2005 12:23 PM

the previous search facility could find text in textareas, the incremental search cannot. That's a major bummer when you edit wiki pages :/

Indeed, I've run into this as well when editing posts for this blog :P

which presents all the search results in a list (broken down by class and method). You can then clcik each one to go to that result in a code window

Doesn't CTRL+SHIFT+F, then F8 already do this?

Jeff Atwood on November 1, 2005 12:27 PM

Johan,
Firefox will highlight other matching terms if you click the "highlight" button on the search toolbar. It highlights text in edit boxes, too, although the "next" and "previous" buttons won't select text in edit boxes.

For any Delphi users reading this, its incremental search command is Ctrl+E.

Rob Kennedy on November 1, 2005 12:38 PM

try F3 !
it works in FF and even in Notepad...

nobody on November 7, 2005 5:35 AM

Joseph Osako: Yes, but since opera isn't editor, you can search instantly by writing .the_word_im_searching_for - i doubt there is any of the applications I use left where I didnt try to use this :)

Keff on May 27, 2006 8:25 AM

"Incremental search is so good that it makes traditional search dialogs completely obsolete."

Sometimes incremental search is NOT what you want. I find it incredibly bothersome when I'm searching for something that turns out to NOT be in the document, that incremental search leaves me at some random place in the document based on the last matching substring. If the search fails, you want your cursor location to be back where you started the search, not at some random place without a full match.

I like incremental search, but to say it makes normal searching completely obsolete is short-sighted.

whm on August 31, 2006 7:52 AM

"After you've worked with incremental search for a few hours, you'll probably wonder why incremental search isn't included as a standard feature in every single Windows application"

Try HandyFind (http://www.handykeys.com). It seemlessly provides incremental search on top of Notepad, Internet Explorer, Word, Excel, and more.

Edwin Evans on October 24, 2006 10:12 AM

Unfortunately, the incremental search in VS does not do regular expressions (or, at least, I can't figure out how to make it do them), so we can't quite retire the dialog box yet.

C. Perkins on May 3, 2007 1:07 PM

I'm not fully in agreement with your view on code folding and #region but I love that I found out VS has incremental search via your link to this post.

Steve Crane on July 7, 2008 8:02 AM

What about Find and Replace? I haven't seen that enacted in an incremental search function before. I think the Excremental dialogue is slightly better for that... until I see an ingeniously-implemented incremental search do it.

Matt S on July 7, 2008 10:22 AM

Notepad++ has the exact same intremental search as Firefox !!!

Laurent

Laurent on July 10, 2008 5:58 AM

Ah, forward slash, how do I love vi [improved]? Let me count the years... 10 ... 20 ... 30?
Inline search is the best reason to love vi, and yes emacs can get a little love too.

And just to show I'm not archaic, I use Resharper on VS2008 for my fancier searches, I've docked my find/replace dialog in an unpinned self-hiding tab at the bottom (near output, take that control-f) and I really like Notepad++ v5+ highlighting all the occurances of a word for me when I doubleclick a word to select it.

Yet I must point out that 'I' is just not close enough to my control key to see much rapid use. Yes, I use the Sun type 7 unix layout keyboard for my typing, though really any kbd with control in the middle of the left will do.

Daniel on July 31, 2008 1:45 PM

(I know this is an old post, but maybe this will help somone.)
@whm if you use incremental search and get lost in your code, try Ctrl minus to go back to your last position.

Ctrl+- (minus) is Navigate backward, Ctrl+_ (underscore) is Navigate forward. There are also buttons on the toolbar (with a blue arrow).


The problem I have with Visual Studio's incremental search is that case-sensitivity keeps turning on (because I use it in the regular find dialog). I wish I could make it always off. Or, even better, it would work like Vim's smartcase: Only case-sensitive if I use capitals.

David on October 9, 2008 9:00 AM

The comments to this entry are closed.