diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index ca860561..b0e4b5f4 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -334,10 +334,10 @@ class GuiDocEditor(QTextEdit): cM = self.mainConf.getTextMargin() vBar = self.verticalScrollBar() - if vBar.isVisible(): - sW = vBar.width() - else: - sW = 0 + sW = vBar.width() if vBar.isVisible() else 0 + + hBar = self.horizontalScrollBar() + sH = hBar.height() if hBar.isVisible() else 0 if self.mainConf.textFixedW or self.theParent.isFocusMode: if self.theParent.isFocusMode: @@ -354,7 +354,7 @@ class GuiDocEditor(QTextEdit): tW = wW - 2*tB - sW tH = self.docHeader.height() fH = self.docFooter.height() - fY = self.height() - fH - tB + fY = self.height() - fH - tB - sH self.docHeader.setGeometry(tB, tB, tW, tH) self.docFooter.setGeometry(tB, fY, tW, fH) diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index f06eff22..c3378806 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -250,17 +250,17 @@ class GuiDocViewer(QTextBrowser): just ensure the margins are set correctly. """ vBar = self.verticalScrollBar() - if vBar.isVisible(): - sW = vBar.width() - else: - sW = 0 + sW = vBar.width() if vBar.isVisible() else 0 + + hBar = self.horizontalScrollBar() + sH = hBar.height() if hBar.isVisible() else 0 cM = self.mainConf.getTextMargin() tB = self.frameWidth() tW = self.width() - 2*tB - sW tH = self.docHeader.height() fH = self.docFooter.height() - fY = self.height() - fH - tB + fY = self.height() - fH - tB - sH self.docHeader.setGeometry(tB, tB, tW, tH) self.docFooter.setGeometry(tB, fY, tW, fH)