From d4e775ebc6052bb82000110233fd9852715c4094 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 13 Mar 2024 14:57:59 +0100 Subject: 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: Reviewed-by: Christian Stenger --- src/plugins/fakevim/fakevim_test.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/fakevim') diff --git a/src/plugins/fakevim/fakevim_test.cpp b/src/plugins/fakevim/fakevim_test.cpp index c81a40a2280..ac1f0a5797c 100644 --- a/src/plugins/fakevim/fakevim_test.cpp +++ b/src/plugins/fakevim/fakevim_test.cpp @@ -9,9 +9,9 @@ #include "fakevimhandler.h" #include -#include +#include #include -#include +#include #include #include @@ -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. -- cgit v1.2.3