]> git.lyx.org Git - features.git/commitdiff
Clean up previous selections with empty searchstr on instant
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 17 Feb 2021 15:55:55 +0000 (16:55 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 17 Feb 2021 15:55:55 +0000 (16:55 +0100)
src/frontends/qt/GuiSearch.cpp
src/lyxfind.cpp

index a9b93d8af0c9fa26cb94f0e206a99ede9dead2c2..0eeaf8dd7532cd1759bbb9c312c5326b2385aabe 100644 (file)
@@ -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);
 }
 
index 50c3381e6dfd62342db5de78241e24fa066c2d48..a34baa372650934aa13c742fa3712ce14f93b7e0 100644 (file)
@@ -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;