X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfind.cpp;h=fbb515ba39991461de42b3b10b9e0b4acc15dda4;hb=d6f1915684328c6e3fe61c6eef8846b5cabec334;hp=bb53c35854739da4d9138dd7785bcdb38430b352;hpb=2bf1c09376de37a3d66b79ca5f4304f29d5b4d06;p=lyx.git diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index bb53c35854..fbb515ba39 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -148,19 +148,19 @@ int replaceAll(BufferView * bv, if (!searchAllowed(bv, searchstr) || buf.isReadonly()) return 0; - bv->cursor().recordUndoFullDocument(); - MatchString const match(searchstr, cs, mw); int num = 0; int const rsize = replacestr.size(); int const ssize = searchstr.size(); - DocIterator cur = doc_iterator_begin(buf.inset()); + Cursor cur(*bv); + cur.setCursor(doc_iterator_begin(buf.inset())); while (findForward(cur, match, false)) { pos_type pos = cur.pos(); - Font const font + Font const & font = cur.paragraph().getFontSettings(buf.params(), pos); + cur.recordUndo(); int striked = ssize - cur.paragraph().eraseChars(pos, pos + ssize, buf.params().trackChanges); cur.paragraph().insert(pos, replacestr, font, @@ -333,10 +333,6 @@ bool findNextChange(BufferView * bv) if (change != orig_change) break; } - // avoid crash (assertion violation) if the imaginary end-of-par - // character of the last paragraph of the document is marked as changed - if (tip.at_end()) - tip.backwardPos(); // Now put cursor to end of selection: bv->cursor().setCursor(cur);