TextDocument: improve & fix high/lowlighting