Merge branch 'dev' into item_layouts

This commit is contained in:
Veronica K. B. Olsen
2021-01-30 00:57:42 +01:00
+9 -3
View File
@@ -345,9 +345,14 @@ class GuiDocEditor(QTextEdit):
qApp.processEvents()
self.setDocumentChanged(False)
qApp.restoreOverrideCursor()
# This is a hack to fix invisble cursor on an empty document
if self.qDocument.characterCount() <= 1:
self.setPlainText("\n")
self.setPlainText("")
self.setCursorPosition(0)
return True
def updateTagHighLighting(self, forceBigDoc=False):
@@ -519,9 +524,10 @@ class GuiDocEditor(QTextEdit):
if not isinstance(thePosition, int):
return False
if thePosition >= 0:
nChars = self.qDocument.characterCount()
if nChars > 1:
theCursor = self.textCursor()
theCursor.setPosition(thePosition)
theCursor.setPosition(min(max(thePosition, 0), nChars-1))
self.setTextCursor(theCursor)
self.docFooter.updateLineCount()