summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qsyntaxhighlighter.cpp
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2009-09-16 12:15:27 (GMT)
committermae <qt-info@nokia.com>2009-09-16 12:20:27 (GMT)
commitfd2090b925f46bc0dfffd34612a9bfcd276c3266 (patch)
tree2f55fb5ab9c66a44a352e028d4a5c253dfce2967 /src/gui/text/qsyntaxhighlighter.cpp
parentc0136ace31e5473493b2e366847968e30f7490a2 (diff)
downloadQt-fd2090b925f46bc0dfffd34612a9bfcd276c3266.zip
Qt-fd2090b925f46bc0dfffd34612a9bfcd276c3266.tar.gz
Qt-fd2090b925f46bc0dfffd34612a9bfcd276c3266.tar.bz2
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
Diffstat (limited to 'src/gui/text/qsyntaxhighlighter.cpp')
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp2
1 files changed, 1 insertions, 1 deletions
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