aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/highlighterhelper.cpp
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/texteditor/highlighterhelper.cpp
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/texteditor/highlighterhelper.cpp')
-rw-r--r--src/plugins/texteditor/highlighterhelper.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/texteditor/highlighterhelper.cpp b/src/plugins/texteditor/highlighterhelper.cpp
index 6aa98439c05..e25b935f8ac 100644
--- a/src/plugins/texteditor/highlighterhelper.cpp
+++ b/src/plugins/texteditor/highlighterhelper.cpp
@@ -9,7 +9,6 @@
#include "texteditor.h"
#include "texteditorsettings.h"
#include "texteditortr.h"
-#include "syntaxhighlighterrunner.h"
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/icore.h>
@@ -210,8 +209,8 @@ void reload()
highlightRepository()->reload();
for (auto editor : Core::DocumentModel::editorsForOpenedDocuments()) {
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor)) {
- if (auto highlighterRunner = textEditor->textDocument()->syntaxHighlighterRunner();
- highlighterRunner && highlighterRunner->useGenericHighlighter()) {
+ if (auto highlighter = textEditor->textDocument()->syntaxHighlighter();
+ highlighter && qobject_cast<SyntaxHighlighter*>(highlighter)) {
textEditor->editorWidget()->configureGenericHighlighter();
}
}