-
- if (bv->theLockingInset()) {
- bool found = forward ?
- bv->theLockingInset()->searchForward(bv, searchstr, casesens, matchwrd) :
- bv->theLockingInset()->searchBackward(bv, searchstr, casesens, matchwrd);
- // We found the stuff inside the inset so we don't have to
- // do anything as the inset did all the update for us!
- if (found)
- return true;
- // We now are in the main text but if we did a forward
- // search we have to put the cursor behind the inset.
- if (forward) {
- bv->text->cursorRight(true);
- }
- }
- // 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;
-
- 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());
- text->setSelectionRange(searchstr.length());
- } else if (result == SR_NOT_FOUND) {
- bv->unlockInset(bv->theLockingInset());
- found = false;