From a2defebe94873ab518da4b77020430b25a878d94 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 27 Nov 2019 00:58:52 +0100 Subject: [PATCH] The replace text method should only be used for large documents --- nw/gui/elements/doceditor.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nw/gui/elements/doceditor.py b/nw/gui/elements/doceditor.py index d2e6d62b..28a63dce 100644 --- a/nw/gui/elements/doceditor.py +++ b/nw/gui/elements/doceditor.py @@ -393,11 +393,13 @@ class GuiDocEditor(QTextEdit): logger.verbose("Running spell checker") if self.spellCheck: - theText = self.getText() - self.clear() bfTime = time() qApp.setOverrideCursor(QCursor(Qt.WaitCursor)) - self.setPlainText(theText) + if self.bigDoc: + theText = self.getText() + self.setPlainText(theText) + else: + self.hLight.rehighlight() qApp.restoreOverrideCursor() afTime = time() logger.debug("Document re-highlighted in %.3f milliseconds" % (1000*(afTime-bfTime)))