Complete handling of search results

This commit is contained in:
Veronica Berglyd Olsen
2024-03-24 15:56:22 +01:00
parent 026aeb3d82
commit becb404203
5 changed files with 73 additions and 21 deletions
+9 -5
View File
@@ -637,6 +637,14 @@ class GuiDocEditor(QPlainTextEdit):
logger.debug("Cursor moved to line %d", line)
return
def setCursorSelection(self, selStart: int, selLength: int) -> None:
"""Make a text selection."""
cursor = self.textCursor()
cursor.setPosition(selStart, QTextCursor.MoveMode.MoveAnchor)
cursor.setPosition(selStart + selLength, QTextCursor.MoveMode.KeepAnchor)
self.setTextCursor(cursor)
return
##
# Spell Checking
##
@@ -791,11 +799,7 @@ class GuiDocEditor(QPlainTextEdit):
def anyFocus(self) -> bool:
"""Check if any widget or child widget has focus."""
if self.hasFocus():
return True
if self.isAncestorOf(qApp.focusWidget()):
return True
return False
return self.hasFocus() or self.isAncestorOf(qApp.focusWidget())
def revealLocation(self) -> None:
"""Tell the user where on the file system the file in the editor