Added scroll past end feature by setting a large root frame margin of the document

This commit is contained in:
Veronica K. B. Olsen
2020-10-11 16:20:47 +02:00
parent 4a47be89de
commit 80e8788baa
2 changed files with 12 additions and 2 deletions
+2
View File
@@ -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
+10 -2
View File
@@ -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