The executable source-highlight works on a complete file, but the code that it uses to highlight the file, operates on single lines, so its library can also operate on a single line, keeping track of the last highlighting state entered (and the user code can query this, store the stack, and set it back).
As for the situation you're describing, it is the QSyntaxHighlighter code itself that will take care of re-highlighting the previous paragraphs, if I didn't get it wrong, otherwise such situations couldn't be handled with QSyntaxHighlighter at all, am I wrong?
But it takes care of checking whether other parts of the file must be highlighted again (by relying on the current and previous state).QSyntaxHighlighter only operates on a subset of possible situations - it is limited but in a sensible way. You are trying to work around those limitations which can result in breaking the mechanism. It might be easier to build your own from scratch without using QSyntaxHighlighter - after all this is a quite stupid class, it's not hard to write your own highlighting engine.
However, I'll try to implement what I meant now that I downloaded the source of Qt 4.4 and finally they added currentBlock() in QSyntaxHighlighter!![]()





Reply With Quote
Bookmarks