X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfind.C;h=932cbec30e0a31df48b9cd37ab980a076802070f;hb=8765ab59cdddad67284007813ef25934ea0042ce;hp=14d84cd857e277d8fb8517f880ea963755b9bf79;hpb=55f575c4dd64dfa0545d7ec044a3718e0e26d778;p=lyx.git diff --git a/src/lyxfind.C b/src/lyxfind.C index 14d84cd857..932cbec30e 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -18,6 +18,7 @@ #include "buffer.h" #include "cursor.h" #include "CutAndPaste.h" +#include "buffer_funcs.h" #include "BufferView.h" #include "debug.h" #include "funcrequest.h" @@ -190,7 +191,7 @@ int replaceAll(BufferView * bv, ++num; } - bv->buffer()->text().init(bv); + updateLabels(buf); bv->putSelectionAt(doc_iterator_begin(buf.inset()), 0, false); if (num) buf.markDirty(); @@ -346,18 +347,24 @@ bool findNextChange(BufferView * bv) Change orig_change = cur.paragraph().lookupChange(cur.pos()); DocIterator et = doc_iterator_end(cur.inset()); + DocIterator ok = cur; // see below for (; cur != et; cur.forwardPosNoDescend()) { + ok = cur; Change change = cur.paragraph().lookupChange(cur.pos()); 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 (cur == et) { + cur = ok; + } + // Now put cursor to end of selection: bv->cursor().setCursor(cur); bv->cursor().setSelection(); - // if we used a lfun like in find/replace, dispatch would do - // that for us - bv->update(); return true; }