aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/fakevim
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/fakevim
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/fakevim')
-rw-r--r--src/plugins/fakevim/fakevim_test.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/fakevim/fakevim_test.cpp b/src/plugins/fakevim/fakevim_test.cpp
index c81a40a228..ac1f0a5797 100644
--- a/src/plugins/fakevim/fakevim_test.cpp
+++ b/src/plugins/fakevim/fakevim_test.cpp
@@ -9,9 +9,9 @@
#include "fakevimhandler.h"
#include <coreplugin/editormanager/editormanager.h>
-#include <texteditor/texteditor.h>
+#include <texteditor/syntaxhighlighter.h>
#include <texteditor/textdocument.h>
-#include <texteditor/syntaxhighlighterrunner.h>
+#include <texteditor/texteditor.h>
#include <QtTest>
#include <QTextEdit>
@@ -350,7 +350,7 @@ struct FakeVimTester::TestData
void doCommand(const char *cmd) { doCommand(_(cmd)); }
void doKeys(const QString &keys) {
handler->handleInput(keys);
- QTRY_VERIFY(editor()->textDocument()->syntaxHighlighterRunner()->syntaxInfoUpdated());
+ QTRY_VERIFY(editor()->textDocument()->syntaxHighlighter()->syntaxHighlighterUpToDate());
}
void doKeys(const char *keys) { doKeys(_(keys)); }
@@ -364,7 +364,7 @@ struct FakeVimTester::TestData
else
i = 0;
editor()->document()->setPlainText(_(str));
- QTRY_VERIFY(editor()->textDocument()->syntaxHighlighterRunner()->syntaxInfoUpdated());
+ QTRY_VERIFY(editor()->textDocument()->syntaxHighlighter()->syntaxHighlighterUpToDate());
setPosition(i);
QCOMPARE(position(), i);
}
@@ -375,7 +375,7 @@ struct FakeVimTester::TestData
QTextCursor tc = editor()->textCursor();
tc.insertText(_(text));
editor()->setTextCursor(tc);
- QTRY_VERIFY(editor()->textDocument()->syntaxHighlighterRunner()->syntaxInfoUpdated());
+ QTRY_VERIFY(editor()->textDocument()->syntaxHighlighter()->syntaxHighlighterUpToDate());
}
// Simulate external position change.