Remove the condition that spell checking must be enabled to refresh highlighting (Issue #1414)

This commit is contained in:
Veronica Berglyd Olsen
2023-04-13 17:57:14 +02:00
parent 8c9f84d251
commit cf770ff77f
+11 -14
View File
@@ -724,14 +724,13 @@ class GuiDocEditor(QTextEdit):
_, theProvider = self.spEnchant.describeDict() _, theProvider = self.spEnchant.describeDict()
self.spellDictionaryChanged.emit(str(theLang), str(theProvider)) self.spellDictionaryChanged.emit(str(theLang), str(theProvider))
if not self._bigDoc: if not self._bigDoc:
self.spellCheckDocument() self.spellCheckDocument()
return True return True
def toggleSpellCheck(self, theMode): def toggleSpellCheck(self, theMode):
"""This is the master spell check setting function, and this one """This is the main spell check setting function, and this one
should call all other setSpellCheck functions in other classes. should call all other setSpellCheck functions in other classes.
If the spell check mode (theMode) is not defined (None), then If the spell check mode (theMode) is not defined (None), then
toggle the current status saved in this class. toggle the current status saved in this class.
@@ -768,18 +767,16 @@ class GuiDocEditor(QTextEdit):
the undo stack, so we only do it for big documents. the undo stack, so we only do it for big documents.
""" """
logger.debug("Running spell checker") logger.debug("Running spell checker")
if self._spellCheck: start = time()
bfTime = time() qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
qApp.setOverrideCursor(QCursor(Qt.WaitCursor)) if self._bigDoc:
if self._bigDoc: # This is much faster for large documents
theText = self.getText() self.setPlainText(self.getText())
self.setPlainText(theText) else:
else: self.highLight.rehighlight()
self.highLight.rehighlight() qApp.restoreOverrideCursor()
qApp.restoreOverrideCursor() logger.debug("Document highlighted in %.3f ms", 1000*(time() - start))
afTime = time() self.mainGui.mainStatus.setStatus(self.tr("Spell check complete"))
logger.debug("Document highlighted in %.3f ms", 1000*(afTime-bfTime))
self.mainGui.mainStatus.setStatus(self.tr("Spell check complete"))
return True return True