aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/glsleditor
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2024-03-13 14:57:59 +0100
committerDavid Schulz <david.schulz@qt.io>2024-03-25 08:57:37 +0000
commitd4e775ebc6052bb82000110233fd9852715c4094 (patch)
tree59a914c74275ea2247500ffd5bf53ccf74d039b9 /src/plugins/glsleditor
parent8500dd03bfb574d13ae1b02ff62d093eac221214 (diff)
TextEditor: handle syntax highlight in batches
Use an elapsed timer in the syntax highlighter to periodically return from the highlight and push a continue highlight to the end of the event loop. This allows the user to interact with the editor in between those batches. If the user modifies the document in between highlighting batches, the area that still needs a rehighlight is increased if needed. This also reverts 62ea85ee6ad15c8e4d9cb5e35b1f10bee3c49ac7 and the related changes. Task-number: QTCREATORBUG-28727 Change-Id: I7c394dbdff658330bb72f3b68b9928980947db75 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r--src/plugins/glsleditor/glslhighlighter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp
index eae8419a04..a6da1d6221 100644
--- a/src/plugins/glsleditor/glslhighlighter.cpp
+++ b/src/plugins/glsleditor/glslhighlighter.cpp
@@ -190,7 +190,8 @@ void GlslHighlighter::highlightBlock(const QString &text)
// if the block is ifdefed out, we only store the parentheses, but
// do not adjust the brace depth.
- if (TextDocumentLayout::ifdefedOut(currentBlock())) {
+ if (TextBlockUserData *userData = TextDocumentLayout::textUserData(currentBlock());
+ userData && userData->ifdefedOut()) {
braceDepth = initialBraceDepth;
foldingIndent = initialBraceDepth;
}