diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index e523c6f7..81c37e04 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -314,12 +314,14 @@ class GuiDocEditor(QTextEdit): just ensure the margins are set correctly. """ cM = self.mainConf.getTextMargin() + + vBar = self.verticalScrollBar() + if vBar.isVisible(): + sW = vBar.width() + else: + sW = 0 + if self.mainConf.textFixedW or self.theParent.isZenMode: - vBar = self.verticalScrollBar() - if vBar.isVisible(): - sW = vBar.width() - else: - sW = 0 if self.theParent.isZenMode: tW = self.mainConf.getZenWidth() else: @@ -332,7 +334,7 @@ class GuiDocEditor(QTextEdit): tM = cM tB = self.lineWidth() - tW = self.width() - 2*tB + tW = self.width() - 2*tB - sW tH = self.docTitle.height() tT = cM - tH self.docTitle.setGeometry(tB, tB, tW, tH) diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index 0624a321..c43c6cc0 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -224,8 +224,14 @@ class GuiDocViewer(QTextBrowser): Config.textFixedW is enabled or we're in Zen mode. Otherwise, just ensure the margins are set correctly. """ + vBar = self.verticalScrollBar() + if vBar.isVisible(): + sW = vBar.width() + else: + sW = 0 + tB = self.lineWidth() - tW = self.width() - 2*tB + tW = self.width() - 2*tB - sW tH = self.docTitle.height() tT = self.mainConf.getTextMargin() - tH self.docTitle.setGeometry(tB, tB, tW, tH)