From 80e8788baaea7f558b6bb90803ae290936e4ab84 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 11 Oct 2020 16:20:47 +0200 Subject: [PATCH] Added scroll past end feature by setting a large root frame margin of the document --- nw/config.py | 2 ++ nw/gui/doceditor.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nw/config.py b/nw/config.py index 5f4a1300..721901ab 100644 --- a/nw/config.py +++ b/nw/config.py @@ -122,6 +122,8 @@ class Config: self.doReplaceDQuote = True self.doReplaceDash = True self.doReplaceDots = True + self.extendScroll = True + self.wordCountTimer = 5.0 self.showTabsNSpaces = False self.showLineEndings = False diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 1d1d2a4e..10f9de3f 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -377,6 +377,7 @@ class GuiDocEditor(QTextEdit): just ensure the margins are set correctly. """ wW = self.width() + wH = self.height() cM = self.mainConf.getTextMargin() vBar = self.verticalScrollBar() @@ -400,7 +401,7 @@ class GuiDocEditor(QTextEdit): tW = wW - 2*tB - sW tH = self.docHeader.height() fH = self.docFooter.height() - fY = self.height() - fH - tB - sH + fY = wH - fH - tB - sH self.docHeader.setGeometry(tB, tB, tW, tH) self.docFooter.setGeometry(tB, fY, tW, fH) @@ -412,7 +413,14 @@ class GuiDocEditor(QTextEdit): else: rH = 0 - self.setViewportMargins(tM, max(cM, tH, rH), tM, max(cM, fH)) + uM = max(cM, tH, rH) + lM = max(cM, fH) + self.setViewportMargins(tM, uM, tM, lM) + + if self.mainConf.extendScroll: + docFrame = self.qDocument.rootFrame().frameFormat() + docFrame.setBottomMargin(wH - uM - lM - self.theTheme.fontPixelSize) + self.qDocument.rootFrame().setFrameFormat(docFrame) return