Clean up previous selections with empty searchstr on instant

This commit is contained in:
Juergen Spitzmueller 2021-02-17 16:55:55 +01:00
parent ab1cc8e1c2
commit 80cb0650e4
2 changed files with 10 additions and 1 deletions

View 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);
}

View 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;