Minor changes to document re-highlighting
This commit is contained in:
+2
-3
@@ -285,7 +285,7 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
self._allowAutoReplace(True)
|
||||
afTime = time()
|
||||
logger.debug("Document highlighted in %.3f milliseconds" % (1000*(afTime-bfTime)))
|
||||
logger.debug("Document highlighted in %.3f ms" % (1000*(afTime-bfTime)))
|
||||
|
||||
self.lastEdit = time()
|
||||
self._runCounter()
|
||||
@@ -557,9 +557,8 @@ class GuiDocEditor(QTextEdit):
|
||||
qApp.restoreOverrideCursor()
|
||||
afTime = time()
|
||||
logger.debug(
|
||||
"Document re-highlighted in %.3f milliseconds" % (1000*(afTime-bfTime))
|
||||
"Document highlighted in %.3f ms" % (1000*(afTime-bfTime))
|
||||
)
|
||||
|
||||
self.theParent.statusBar.showMessage("Spell check complete")
|
||||
|
||||
return True
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
import nw
|
||||
import logging
|
||||
|
||||
from time import time
|
||||
|
||||
from PyQt5.QtCore import Qt, QRegularExpression
|
||||
from PyQt5.QtGui import (
|
||||
QColor, QTextCharFormat, QFont, QSyntaxHighlighter, QBrush
|
||||
@@ -244,10 +246,15 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
"""
|
||||
qDocument = self.document()
|
||||
nBlocks = qDocument.blockCount()
|
||||
bfTime = time()
|
||||
for i in range(nBlocks):
|
||||
theBlock = qDocument.findBlockByNumber(i)
|
||||
if theBlock.userState() & theType == theType:
|
||||
if theBlock.userState() & theType > 0:
|
||||
self.rehighlightBlock(theBlock)
|
||||
afTime = time()
|
||||
logger.debug(
|
||||
"Document highlighted in %.3f ms" % (1000*(afTime-bfTime))
|
||||
)
|
||||
return
|
||||
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user