if (!searchAllowed(bv, searchstr) || buf.isReadonly())
return 0;
+ DocIterator cur_orig(bv->cursor());
+
MatchString const match(searchstr, cs, mw);
int num = 0;
bv->putSelectionAt(doc_iterator_begin(&buf), 0, false);
if (num)
buf.markDirty();
+
+ cur_orig.fixIfBroken();
+ bv->setCursor(cur_orig);
+
return num;
}
bool find(BufferView * bv, FuncRequest const & ev)
{
- if (!bv || ev.action != LFUN_WORD_FIND)
+ if (!bv || ev.action() != LFUN_WORD_FIND)
return false;
//lyxerr << "find called, cmd: " << ev << endl;
void replace(BufferView * bv, FuncRequest const & ev, bool has_deleted)
{
- if (!bv || ev.action != LFUN_WORD_REPLACE)
+ if (!bv || ev.action() != LFUN_WORD_REPLACE)
return;
// data is of the form
if (bv->cursor().selection()) {
// set the cursor at the beginning or at the end of the selection
// before searching. Otherwise, the current change will be found.
- if (next != (bv->cursor().top() > bv->cursor().anchor()))
+ if (next != (bv->cursor().top() > bv->cursor().normalAnchor()))
bv->cursor().setCursorToAnchor();
}