Fix bug #6428: Assertion when navigating to next change while in math mode.

We need to leave the math inset before trying to access cur.paragraph().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32791 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-01-06 17:29:39 +00:00
parent 742ee134a4
commit 5079badb65

View File

@ -377,11 +377,18 @@ bool findChange(BufferView * bv, bool next)
// clear the selection and search the other way around (see the end
// of this function). This will avoid changes to be selected half.
bool search_both_sides = false;
if (cur.pos() > 0) {
Change change_next_pos
= cur.paragraph().lookupChange(cur.pos());
DocIterator tmpcur = cur;
// Leave math first
while (tmpcur.inMathed())
tmpcur.pop_back();
Change change_next_pos
= tmpcur.paragraph().lookupChange(tmpcur.pos());
if (change_next_pos.changed() && cur.inMathed()) {
cur = tmpcur;
search_both_sides = true;
} else if (tmpcur.pos() > 0 && tmpcur.inTexted()) {
Change change_prev_pos
= cur.paragraph().lookupChange(cur.pos() - 1);
= tmpcur.paragraph().lookupChange(tmpcur.pos() - 1);
if (change_next_pos.isSimilarTo(change_prev_pos))
search_both_sides = true;
}