Some improvements in "highlighting"

> :construction_worker: :construction:&nbsp; **Not ready to merge!** &nbsp;:construction: :construction_worker:

A number of fixes, especially for #1212 (which I made this PR for).

 - [x] Fix "the NULL class" bug. (see d96c2d0 for details and steps to reproduce)
 - [x] Format, improve and optimize the `match-highlighter` addon.
 - [ ] Add the selection-mode option (solves #1212).

Watch out! Feel free to provide any feedback you want.