From fd2090b925f46bc0dfffd34612a9bfcd276c3266 Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 16 Sep 2009 14:15:27 +0200 Subject: Fix to QSyntaxHighlighter not rehighlighting enough When entire blocks get deleted, the last block for rehighlighting would be the block _before_ the deleted blocks. This is wrong, since the deleted blocks could have contained characters which affect the state. The patch lets the highlighter check for one more character. Reviewed-by: thorbjorn --- src/gui/text/qsyntaxhighlighter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 41f4b4a..470c8e1 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -170,7 +170,7 @@ void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, in return; int endPosition; - QTextBlock lastBlock = doc->findBlock(from + charsAdded); + QTextBlock lastBlock = doc->findBlock(from + charsAdded + (charsRemoved > 0 ? 1 : 0)); if (lastBlock.isValid()) endPosition = lastBlock.position() + lastBlock.length(); else -- cgit v0.12