commit 80cb0650e44e7ef580c0a33637e8abb689ed6837
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed Feb 17 16:55:55 2021 +0100

    Clean up previous selections with empty searchstr on instant
---
 src/frontends/qt/GuiSearch.cpp |    2 +-
 src/lyxfind.cpp                |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/frontends/qt/GuiSearch.cpp b/src/frontends/qt/GuiSearch.cpp
index a9b93d8..0eeaf8d 100644
--- a/src/frontends/qt/GuiSearch.cpp
+++ b/src/frontends/qt/GuiSearch.cpp
@@ -193,7 +193,7 @@ void GuiSearchWidget::findChanged()
        replacePB->setEnabled(replace);
        replacePrevPB->setEnabled(replace);
        replaceallPB->setEnabled(replace);
-       if (instantSearchCB->isChecked() && !emptytext)
+       if (instantSearchCB->isChecked())
                doFind(false, true);
 }
 
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 50c3381..a34baa3 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -279,6 +279,15 @@ bool findOne(BufferView * bv, docstring const & searchstr,
             bool find_del, bool check_wrap, bool auto_wrap,
             bool instant, bool onlysel)
 {
+       // Clean up previous selections with empty searchstr on instant
+       if (searchstr.empty() && instant) {
+               if (bv->cursor().selection()) {
+                       bv->setCursor(bv->cursor().selectionBegin());
+                       bv->clearSelection();
+               }
+               return false;
+       }
+
        if (!searchAllowed(searchstr))
                return false;
 
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to