From: Juergen Spitzmueller Date: Wed, 17 Feb 2021 15:55:55 +0000 (+0100) Subject: Clean up previous selections with empty searchstr on instant X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=80cb0650e44e7ef580c0a33637e8abb689ed6837;p=features.git Clean up previous selections with empty searchstr on instant --- diff --git a/src/frontends/qt/GuiSearch.cpp b/src/frontends/qt/GuiSearch.cpp index a9b93d8af0..0eeaf8dd75 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 50c3381e6d..a34baa3726 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;