Change name of scroll position variable and fix calculation of it

This commit is contained in:
Veronica K. B. Olsen
2020-10-11 23:03:37 +02:00
parent 322be33ac4
commit d0bda15b0a
5 changed files with 16 additions and 16 deletions
+4 -4
View File
@@ -128,7 +128,7 @@ class Config:
self.doReplaceDots = True self.doReplaceDots = True
self.scrollPastEnd = True self.scrollPastEnd = True
self.scollWithCursor = False self.scollWithCursor = False
self.scollFromPoint = 40 self.scollToPoint = 40
self.wordCountTimer = 5.0 self.wordCountTimer = 5.0
self.showTabsNSpaces = False self.showTabsNSpaces = False
@@ -468,8 +468,8 @@ class Config:
self.scollWithCursor = self._parseLine( self.scollWithCursor = self._parseLine(
cnfParse, cnfSec, "scollwithcursor", self.CNF_BOOL, self.scollWithCursor cnfParse, cnfSec, "scollwithcursor", self.CNF_BOOL, self.scollWithCursor
) )
self.scollFromPoint = self._parseLine( self.scollToPoint = self._parseLine(
cnfParse, cnfSec, "scollfrompoint", self.CNF_INT, self.scollFromPoint cnfParse, cnfSec, "scolltopoint", self.CNF_INT, self.scollToPoint
) )
self.fmtSingleQuotes = self._parseLine( self.fmtSingleQuotes = self._parseLine(
cnfParse, cnfSec, "fmtsinglequote", self.CNF_LIST, self.fmtSingleQuotes cnfParse, cnfSec, "fmtsinglequote", self.CNF_LIST, self.fmtSingleQuotes
@@ -617,7 +617,7 @@ class Config:
cnfParse.set(cnfSec, "repdots", str(self.doReplaceDots)) cnfParse.set(cnfSec, "repdots", str(self.doReplaceDots))
cnfParse.set(cnfSec, "scrollpastend", str(self.scrollPastEnd)) cnfParse.set(cnfSec, "scrollpastend", str(self.scrollPastEnd))
cnfParse.set(cnfSec, "scollwithcursor", str(self.scollWithCursor)) cnfParse.set(cnfSec, "scollwithcursor", str(self.scollWithCursor))
cnfParse.set(cnfSec, "scollfrompoint", str(self.scollFromPoint)) cnfParse.set(cnfSec, "scolltopoint", str(self.scollToPoint))
cnfParse.set(cnfSec, "fmtsinglequote", self._packList(self.fmtSingleQuotes)) cnfParse.set(cnfSec, "fmtsinglequote", self._packList(self.fmtSingleQuotes))
cnfParse.set(cnfSec, "fmtdoublequote", self._packList(self.fmtDoubleQuotes)) cnfParse.set(cnfSec, "fmtdoublequote", self._packList(self.fmtDoubleQuotes))
cnfParse.set(cnfSec, "spelltool", str(self.spellTool)) cnfParse.set(cnfSec, "spelltool", str(self.spellTool))
+2 -2
View File
@@ -775,9 +775,9 @@ class GuiDocEditor(QTextEdit):
kMod = keyEvent.modifiers() kMod = keyEvent.modifiers()
if kMod == Qt.NoModifier or kMod == Qt.ShiftModifier: if kMod == Qt.NoModifier or kMod == Qt.ShiftModifier:
cPos = self.cursorRect().center().y() cPos = self.cursorRect().center().y()
mPos = self.mainConf.scollFromPoint*self.height()*0.01 mPos = self.mainConf.scollToPoint * self.viewport().height()
vBar = self.verticalScrollBar() vBar = self.verticalScrollBar()
vBar.setValue(vBar.value() + cPos - round(mPos)) vBar.setValue(vBar.value() + cPos - round(mPos * 0.01))
self.ensureCursorVisible() self.ensureCursorVisible()
return return
+8 -8
View File
@@ -578,14 +578,14 @@ class GuiConfigEditLayoutTab(QWidget):
) )
## Font Size ## Font Size
self.scollFromPoint = QSpinBox(self) self.scollToPoint = QSpinBox(self)
self.scollFromPoint.setMinimum(10) self.scollToPoint.setMinimum(10)
self.scollFromPoint.setMaximum(90) self.scollToPoint.setMaximum(90)
self.scollFromPoint.setSingleStep(1) self.scollToPoint.setSingleStep(1)
self.scollFromPoint.setValue(self.mainConf.scollFromPoint) self.scollToPoint.setValue(self.mainConf.scollToPoint)
self.mainForm.addRow( self.mainForm.addRow(
"Position in the editor to keep the cursor", "Position in the editor to keep the cursor",
self.scollFromPoint, self.scollToPoint,
"In units of percentage of the editor height.", "In units of percentage of the editor height.",
theUnit = "%" theUnit = "%"
) )
@@ -609,7 +609,7 @@ class GuiConfigEditLayoutTab(QWidget):
tabWidth = self.tabWidth.value() tabWidth = self.tabWidth.value()
scrollPastEnd = self.scrollPastEnd.isChecked() scrollPastEnd = self.scrollPastEnd.isChecked()
scollWithCursor = self.scollWithCursor.isChecked() scollWithCursor = self.scollWithCursor.isChecked()
scollFromPoint = self.scollFromPoint.value() scollToPoint = self.scollToPoint.value()
self.mainConf.textFont = textFont self.mainConf.textFont = textFont
self.mainConf.textSize = textSize self.mainConf.textSize = textSize
@@ -622,7 +622,7 @@ class GuiConfigEditLayoutTab(QWidget):
self.mainConf.tabWidth = tabWidth self.mainConf.tabWidth = tabWidth
self.mainConf.scrollPastEnd = scrollPastEnd self.mainConf.scrollPastEnd = scrollPastEnd
self.mainConf.scollWithCursor = scollWithCursor self.mainConf.scollWithCursor = scollWithCursor
self.mainConf.scollFromPoint = scollFromPoint self.mainConf.scollToPoint = scollToPoint
self.mainConf.confChanged = True self.mainConf.confChanged = True
+1 -1
View File
@@ -41,7 +41,7 @@ repdash = True
repdots = True repdots = True
scrollpastend = True scrollpastend = True
scollwithcursor = False scollwithcursor = False
scollfrompoint = 40 scolltopoint = 40
fmtsinglequote = , fmtsinglequote = ,
fmtdoublequote = “, ” fmtdoublequote = “, ”
spelltool = internal spelltool = internal
+1 -1
View File
@@ -41,7 +41,7 @@ repdash = True
repdots = True repdots = True
scrollpastend = False scrollpastend = False
scollwithcursor = True scollwithcursor = True
scollfrompoint = 40 scolltopoint = 40
fmtsinglequote = , fmtsinglequote = ,
fmtdoublequote = “, ” fmtdoublequote = “, ”
spelltool = internal spelltool = internal