From 77ec41a820518edd67967f4b9c126347b938d852 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 11 Oct 2020 21:43:26 +0200 Subject: [PATCH] Make sure scroll past end margin cannot be negative --- nw/gui/doceditor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 99e86764..9cbe1abb 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -440,7 +440,8 @@ class GuiDocEditor(QTextEdit): if self.mainConf.scrollPastEnd: docFrame = self.qDocument.rootFrame().frameFormat() - docFrame.setBottomMargin(wH - uM - lM - 5*self.theTheme.fontPixelSize) + docMargin = wH - uM - lM - 5*self.theTheme.fontPixelSize + docFrame.setBottomMargin(max(0, docMargin)) self.qDocument.rootFrame().setFrameFormat(docFrame) return