X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfind.cpp;h=fd44187104fdb9a6d80ed04f18cb54c0875f562b;hb=3c957e1bb1ca487cb5bb9b02145c009a7f5fe02d;hp=b615ff69838ed9cd7da853b39e3118848aa0862b;hpb=57aa866a1c5e5f401a5f39ed81d2823bc6f2e3e7;p=lyx.git diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index b615ff6983..fd44187104 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -171,6 +171,8 @@ int replaceAll(BufferView * bv, if (!searchAllowed(bv, searchstr) || buf.isReadonly()) return 0; + DocIterator cur_orig(bv->cursor()); + MatchString const match(searchstr, cs, mw); int num = 0; @@ -198,6 +200,10 @@ int replaceAll(BufferView * bv, bv->putSelectionAt(doc_iterator_begin(&buf), 0, false); if (num) buf.markDirty(); + + cur_orig.fixIfBroken(); + bv->setCursor(cur_orig); + return num; } @@ -279,7 +285,7 @@ docstring const replace2string(docstring const & replace, 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; @@ -300,7 +306,7 @@ bool find(BufferView * bv, FuncRequest const & ev) 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 @@ -365,7 +371,7 @@ bool findChange(BufferView * bv, bool next) 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(); }