mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 11:52:25 +00:00
Fixed infinite loop on backwards search when matching in nested inset(s) at begin of document.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32650 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
27d580b5c0
commit
569a0e4629
@ -1022,6 +1022,7 @@ int findBackwardsAdv(DocIterator & cur, MatchStringAdv const & match) {
|
|||||||
else
|
else
|
||||||
cur.pos() = cur_orig.pos();
|
cur.pos() = cur_orig.pos();
|
||||||
LYXERR(Debug::FIND, "findBackAdv2: cur: " << cur);
|
LYXERR(Debug::FIND, "findBackAdv2: cur: " << cur);
|
||||||
|
DocIterator cur_prev_iter;
|
||||||
if (found_match) {
|
if (found_match) {
|
||||||
while (true) {
|
while (true) {
|
||||||
found_match=match(cur);
|
found_match=match(cur);
|
||||||
@ -1031,12 +1032,14 @@ int findBackwardsAdv(DocIterator & cur, MatchStringAdv const & match) {
|
|||||||
int len;
|
int len;
|
||||||
findMostBackwards(cur, match, len);
|
findMostBackwards(cur, match, len);
|
||||||
if (&cur.inset() != &cur_orig.inset()
|
if (&cur.inset() != &cur_orig.inset()
|
||||||
|| !(cur.pit()==cur_orig.pit())
|
|| !(cur.pit() == cur_orig.pit())
|
||||||
|| cur.pos() < cur_orig.pos())
|
|| cur.pos() < cur_orig.pos())
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
if (cur == cur_begin)
|
// Prevent infinite loop at begin of document
|
||||||
|
if (cur == cur_begin || cur == cur_prev_iter)
|
||||||
break;
|
break;
|
||||||
|
cur_prev_iter = cur;
|
||||||
cur.backwardPos();
|
cur.backwardPos();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user