- // If we arrive here we are in the main text again so we
- // just start searching from the root LyXText at the position
- // we are!
- LyXText * text = bv->text;
-
- if (text->selection.set())
- text->cursor = forward ?
- text->selection.end : text->selection.start;
-
- bv->toggleSelection();
- text->clearSelection();
-
- SearchResult result = forward ?
- SearchForward(bv, text, searchstr, casesens, matchwrd) :
- SearchBackward(bv, text, searchstr, casesens, matchwrd);
-
- bool found = true;
- // If we found the cursor inside an inset we will get back
- // SR_FOUND_NOUPDATE and we don't have to do anything as the
- // inset did it already.
- if (result == SR_FOUND) {
- bv->unlockInset(bv->theLockingInset());
- bv->update(text, BufferView::SELECT);
- text->setSelectionRange(searchstr.length());
- bv->toggleSelection(false);
- bv->update(text, BufferView::SELECT);
- } else if (result == SR_NOT_FOUND) {
- bv->unlockInset(bv->theLockingInset());
- bv->update(text, BufferView::SELECT);
- found = false;
+ return false;
+}
+
+
+bool findChange(DocIterator & cur)
+{
+ for (; cur; cur.forwardChar())
+ if (cur.inTexted() && !cur.paragraph().empty() &&
+ cur.paragraph().lookupChange(cur.pos())
+ != Change::UNCHANGED)
+ return true;
+ return false;
+}
+
+
+bool searchAllowed(BufferView * bv, string const & str)
+{
+ if (str.empty()) {
+ Alert::error(_("Search error"), _("Search string is empty"));
+ return false;