Fix bug 850453, the repeated-results thing.

It was faster (and yielded more readable code) to rewrite the highlighting stuff than to fix what was there.