Merge pull request #153 from vkbo/large_text_performance

Prevent re-highlight on resize
This commit is contained in:
Veronica K. Berglyd Olsen authored and GitHub committed 2019-11-19 10:44:40 +01:00
commit aee7a1a66d
2 files changed
+9 -1

No files matched your search

+7 -1
View File
@@ -258,7 +258,7 @@ class GuiDocEditor(QTextEdit):
def updateDocMargins(self):
"""Automatically adjust the margins so the text is centred, but
only if Config.textFixedW is set to True.
only if Config.textFixedW is enabled or we're in Zen mode.
"""
if self.mainConf.textFixedW or self.theParent.isZenMode:
@@ -281,7 +281,13 @@ class GuiDocEditor(QTextEdit):
docFormat = self.qDocument.rootFrame().frameFormat()
docFormat.setLeftMargin(tM)
docFormat.setRightMargin(tM)
# Updating root frame triggers a QTextDocument->contentsChange
# signal, which we do not want as it re-runs the syntax
# highlighter and spell checker, so we block it briefly.
self.qDocument.blockSignals(True)
self.qDocument.rootFrame().setFrameFormat(docFormat)
self.qDocument.blockSignals(False)
return
+2
View File
@@ -106,11 +106,13 @@ class GuiMain(QMainWindow):
self.viewPane.setLayout(self.docView)
self.splitView = QSplitter(Qt.Horizontal)
self.splitView.setOpaqueResize(False)
self.splitView.addWidget(self.editPane)
self.splitView.addWidget(self.viewPane)
self.splitMain = QSplitter(Qt.Horizontal)
self.splitMain.setContentsMargins(4,4,4,4)
self.splitMain.setOpaqueResize(False)
self.splitMain.addWidget(self.treePane)
self.splitMain.addWidget(self.splitView)
self.splitMain.setSizes(self.mainConf.mainPanePos)