Traditional autocomplete is such a powerful tool that it’s managed to work its way into most desktop and a significant number of web applications. Type a URL into your browser, and the address bar will offer suggestions for all of the URLs in your browsing history that begin with the text that precedes your cursor. Autocomplete works well, but it could be better.

László Kozma brought up a problem that tends to crop up in a number of scenarios: if you move the cursor back to correct or change part of the entry string, traditional autocomplete completely ignores any context to the right of the cursor. In some applications, this means everything to the right of the cursor is ignored and overwritten instead of being part of the search. In Safari, if you type anything between “www.” and “.com”, autocomplete fails entirely, offering no results unless you clear out everything to the right of the cursor.

One solution, which László termed “reverse autocomplete”, is to split the string at the cursor position and attempt to find matches for both anything after the first half and before the second half. Any matches that show up in both sets are the final autocomplete suggestions. The result is that if I type in “www.h|.com” (where my cursor position is represented by the “|” character) the smarter autocomplete might return “www.hackszine.com” as a suggestion but omit from telling me about “www.h-is-aitch.org”.

You can take it one step further and also match against the beginning and ends of the entire string. This solves a really common problem that I run into regularly when searching through a large contact list, say the typical corporate email system. If you don’t know the correct spelling of someone’s name, or if you only can recall initials, you can fill in the parts you know. The system would be smart enough to turn “J|S” into “Jason Striegel” instead of forcing you to page through a huge list of J names.

Reverse autocomplete