Fix another subtle bug with the syntax highlighting

* the length of the event can be non-zero when there is no replaced text
specified
* optimized the case of re-classifying the whole document a bit
* optimized the case of a zero-delta re-classification (this occurs when
error markers are being added to a file)