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:
Tommaso Cucinotta 2009-12-26 22:10:14 +00:00
parent 27d580b5c0
commit 569a0e4629

View File

@ -1022,6 +1022,7 @@ int findBackwardsAdv(DocIterator & cur, MatchStringAdv const & match) {
else
cur.pos() = cur_orig.pos();
LYXERR(Debug::FIND, "findBackAdv2: cur: " << cur);
DocIterator cur_prev_iter;
if (found_match) {
while (true) {
found_match=match(cur);
@ -1035,8 +1036,10 @@ int findBackwardsAdv(DocIterator & cur, MatchStringAdv const & match) {
|| cur.pos() < cur_orig.pos())
return len;
}
if (cur == cur_begin)
// Prevent infinite loop at begin of document
if (cur == cur_begin || cur == cur_prev_iter)
break;
cur_prev_iter = cur;
cur.backwardPos();
};
}