X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfind.C;h=932cbec30e0a31df48b9cd37ab980a076802070f;hb=52eb91c94fb70d58dceef430659c8781de2eccda;hp=d8e08dd8036e174e418ff4ceb05871c29bb2ddcd;hpb=fed31122c415f4b310e254e5db7197f786960b01;p=lyx.git diff --git a/src/lyxfind.C b/src/lyxfind.C index d8e08dd803..932cbec30e 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -29,7 +29,6 @@ #include "undo.h" #include "frontends/Alert.h" -#include "frontends/Selection.h" #include "support/convert.h" #include "support/docstream.h" @@ -348,19 +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(); - theSelection().haveSelection(bv->cursor().selection()); - // if we used a lfun like in find/replace, dispatch would do - // that for us - bv->update(); return true; }