X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfind.cpp;h=bf99caf33f536244fb1315d73eeea7b95a7c8eeb;hb=2098f1d8c20d51e63e670bcdc9da8996068975bf;hp=d5653a6feb10a17779f1235185951357ad9042fd;hpb=b0910eb6d4dcba0dfa79a9a2a55e3ad6f32dea95;p=lyx.git diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index d5653a6feb..bf99caf33f 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -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; }