From 1659d2a110f1f8372a2a4636955174bec698fe7a Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 18 Nov 2019 10:30:07 +0100 Subject: [PATCH 1/2] Disable opaque resize of splitters --- nw/guimain.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nw/guimain.py b/nw/guimain.py index 0a3a87fc..853b3e33 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -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) From 78a8f5bb9cad191e3e0a3bfd55630d9958d91719 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Tue, 19 Nov 2019 10:36:43 +0100 Subject: [PATCH 2/2] Make sure a contentsChange signal is not emitted when document margins change --- nw/gui/elements/doceditor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nw/gui/elements/doceditor.py b/nw/gui/elements/doceditor.py index 7cc4a186..c8b69df7 100644 --- a/nw/gui/elements/doceditor.py +++ b/nw/gui/elements/doceditor.py @@ -250,7 +250,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: @@ -273,7 +273,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