summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index d3db2a1..28af5bb 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -95,6 +95,8 @@ public:
void QSyntaxHighlighterPrivate::applyFormatChanges()
{
+ bool formatsChanged = false;
+
QTextLayout *layout = currentBlock.layout();
QList<QTextLayout::FormatRange> ranges = layout->additionalFormats();
@@ -110,6 +112,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
++it;
} else {
it = ranges.erase(it);
+ formatsChanged = true;
}
}
}
@@ -147,6 +150,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
}
ranges << r;
+ formatsChanged = true;
r.start = -1;
}
@@ -161,9 +165,13 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
}
ranges << r;
+ formatsChanged = true;
}
- layout->setAdditionalFormats(ranges);
+ if (formatsChanged) {
+ layout->setAdditionalFormats(ranges);
+ doc->markContentsDirty(currentBlock.position(), currentBlock.length());
+ }
}
void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded)
@@ -214,8 +222,6 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
q->highlightBlock(block.text());
applyFormatChanges();
- doc->markContentsDirty(block.position(), block.length());
-
currentBlock = QTextBlock();
}