From c506212efd56484d4cdf5a1c82e611ee6b4bd993 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 27 Jul 2020 20:14:23 +0200 Subject: [PATCH] Some minor code tweaks --- nw/gui/doceditor.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 91c1aa51..a4d88f65 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -1262,20 +1262,19 @@ class GuiDocEditor(QTextEdit): searchFor = self.docSearch.getSearchText() replWith = self.docSearch.getReplaceText() - selText = theCursor.selectedText() if self.docSearch.doMatchCap: - replWith = transferCase(selText, replWith) + replWith = transferCase(theCursor.selectedText(), replWith) # Make sure the selected text was selected by an actual find # call, and not the user. try: - isResult = self.lastFind[0] == theCursor.selectionStart() - isResult &= self.lastFind[1] == theCursor.selectionEnd() + isFind = self.lastFind[0] == theCursor.selectionStart() + isFind &= self.lastFind[1] == theCursor.selectionEnd() except: - isResult = False + isFind = False - if isResult: + if isFind: theCursor.beginEditBlock() theCursor.removeSelectedText() theCursor.insertText(replWith)