From 7c3eb168004e9cb1271f7e16a2bb68db82611135 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:30:02 +0100 Subject: [PATCH] Be even more specific on what widget to return focus to after searching next document --- novelwriter/gui/doceditor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index 4a18d7c3..050487da 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -1326,7 +1326,7 @@ class GuiDocEditor(QPlainTextEdit): self.beginSearch() return - rFocus = self.docSearch.searchBox if self.docSearch.anyFocus() else self + prevFocus = QApplication.focusWidget() or self resS, resE = self.findAllOccurences() if len(resS) == 0 and self._docHandle: self.docSearch.setResultCount(0, 0) @@ -1335,7 +1335,7 @@ class GuiDocEditor(QPlainTextEdit): self.requestNextDocument.emit(self._docHandle, CONFIG.searchLoop) QApplication.processEvents() self.beginSearch() - rFocus.setFocus() + prevFocus.setFocus() return cursor = self.textCursor() @@ -1355,7 +1355,7 @@ class GuiDocEditor(QPlainTextEdit): self.requestNextDocument.emit(self._docHandle, CONFIG.searchLoop) QApplication.processEvents() self.beginSearch() - rFocus.setFocus() + prevFocus.setFocus() return else: resIdx = 0 if doLoop else maxIdx