It would be much better if we had a single unindent function which is used either from here or from `highlightText`.

The current code in `highlightText` has become very messy because it mixes in code for indentation, macros, etc, all in one big switch statement. It makes for code which is very hard to understand and maintain.

And the code below makes little sense to me, why is space being written to buf?