Back-references not consideres all tags in a document, not just the first one

This commit is contained in:
Veronica K. B. Olsen
2020-05-25 21:14:50 +02:00
parent e7f0751275
commit 3b7927f0ff
8 changed files with 81 additions and 34 deletions
+4 -1
View File
@@ -395,6 +395,8 @@ class GuiDocEditor(QTextEdit):
def setCursorPosition(self, thePosition):
"""Move the cursor to a given position in the document.
"""
if not isinstance(thePosition, int):
return False
if thePosition >= 0:
theCursor = self.textCursor()
theCursor.setPosition(thePosition)
@@ -410,12 +412,13 @@ class GuiDocEditor(QTextEdit):
def setCursorLine(self, theLine):
"""Move the cursor to a given line in the document.
"""
if theLine is None:
if not isinstance(theLine, int):
return False
if theLine >= 0:
theBlock = self.qDocument.findBlockByLineNumber(theLine)
if theBlock:
self.setCursorPosition(theBlock.position())
logger.verbose("Cursor moved to line %d" % theLine)
return True
##