]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.cpp
Fix a crash when closing tabs
[lyx.git] / src / lyxfind.cpp
index 50c3381e6dfd62342db5de78241e24fa066c2d48..46e1283ecfd696aec6d7a357cba6ea5344b2e360 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 true;
+       }
+
        if (!searchAllowed(searchstr))
                return false;