diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 5c958015d3..5cb5c2189f 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -421,21 +421,24 @@ bool findChange(BufferView * bv, bool next) // of this function). This will avoid changes to be selected half. bool search_both_sides = false; Cursor tmpcur = cur; - // Leave math first + // Find enclosing text cursor 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 - = tmpcur.paragraph().lookupChange(tmpcur.pos() - 1); - if (change_next_pos.isSimilarTo(change_prev_pos)) + if (change_next_pos.changed()) { + if (cur.inMathed()) { + cur = tmpcur; search_both_sides = true; + } else if (tmpcur.pos() > 0 && tmpcur.inTexted()) { + Change change_prev_pos + = tmpcur.paragraph().lookupChange(tmpcur.pos() - 1); + if (change_next_pos.isSimilarTo(change_prev_pos)) + search_both_sides = true; + } } + // find the next change if (!findChange(cur, next)) return false; @@ -443,7 +446,7 @@ bool findChange(BufferView * bv, bool next) CursorSlice & tip = cur.top(); - if (!next) + if (!next && tip.pos() > 0) // take a step into the change tip.backwardPos(); diff --git a/status.20x b/status.20x index 66f5198223..dfe64f7b31 100644 --- a/status.20x +++ b/status.20x @@ -77,7 +77,10 @@ What's new - Fix hang when using BibTeX files with really long author lists (bug 8944). -- Fix crash with changetracking in bibliography environment (bug 8646). +- Fix crash with changetracking in bibliography environment (bug + 8646). + +- Fix crash when navigating to next change (bug 8884). - Fix crash when optional argument inside a math macro was deleted (bug 8329).