The bug: http://bugzilla.lyx.org/show_bug.cgi?id=3785
Stefan Index: lyx-devel/src/DocIterator.cpp ===================================================================--- lyx-devel.orig/src/DocIterator.cpp 2007-05-29 08:36:01.000000000 +0200
+++ lyx-devel/src/DocIterator.cpp 2007-06-08 19:35:53.000000000 +0200 @@ -562,46 +562,58 @@ { bool fixed = false; - for (size_t i = slices_.size() - 1; i != 0; --i) + // The top level CursorSlice should always be valid. + BOOST_ASSERT(slices_.size() == 0 || slices_[0].isValid()); ++ // cut off from the first invalid slice, and correct slices if possible
+ for (size_t i = 0; i < slices_.size(); ++i) { + // invalid because of inset == 0? if (!slices_[i].isValid()) { - pop_back(); + slices_.resize(i); fixed = true; + break; } - // The top level CursorSlice should always be valid. - BOOST_ASSERT(slices_[0].isValid()); - - if (idx() > lastidx()) { - lyxerr << "wrong idx " << idx() - << ", max is " << lastidx() - << " at level " << depth() - << ". Trying to correct this." << endl; - lyxerr << "old: " << *this << endl; - for (size_t i = idx(); i != lastidx(); --i) - pop_back(); - idx() = lastidx(); - pit() = lastpit(); - pos() = lastpos(); - fixed = true; - } - else if (pit() > lastpit()) { - lyxerr << "wrong pit " << pit() - << ", max is " << lastpit() - << " at level " << depth() - << ". Trying to correct this." << endl; - lyxerr << "old: " << *this << endl; - pit() = lastpit(); - pos() = 0; - fixed = true; - } - else if (pos() > lastpos()) { - lyxerr << "wrong pos " << pos() - << ", max is " << lastpos() - << " at level " << depth() - << ". Trying to correct this." << endl; - lyxerr << "old: " << *this << endl; - pos() = lastpos(); - fixed = true; + if (slices_[i].idx() > slices_[i].lastidx()) { + lyxerr << "wrong idx " << slices_[i].idx() + << ", max is " << slices_[i].lastidx() + << " at level " << i + << ". Trying to correct this." << endl; + lyxerr << "old: " << *this << endl; + // put in last index and position + slices_.resize(i + 1); + slices_[i].idx() = lastidx(); + slices_[i].pit() = lastpit(); + slices_[i].pos() = lastpos(); + fixed = true; + break; + } + else if (!slices_[i].inset().inMathed() && + slices_[i].text() &&+ slices_[i].pit() > slices_[i].text()->paragraphs().size() - 1) {
+ pit_type lastpit = slices_[i].text()->paragraphs().size() - 1; + lyxerr << "wrong pit " << slices_[i].pit() + << ", max is " << lastpit + << " at level " << i + << ". Trying to correct this." << endl; + lyxerr << "old: " << *this << endl; + slices_.resize(i + 1); + slices_[i].pit() = lastpit; + slices_[i].pos() = 0; + fixed = true; + break; + } + else if (slices_[i].pos() > slices_[i].lastpos()) { + lyxerr << "wrong pos " << slices_[i].pos() + << ", max is " << slices_[i].lastpos() + << " at level " << i + << ". Trying to correct this." << endl; + lyxerr << "old: " << *this << endl; + slices_.resize(i + 1); + slices_[i].pos() = slices_[i].lastpos(); + fixed = true; + break; + } } if (fixed) { lyxerr << "new: " << *this << endl;
PGP.sig
Description: Signierter Teil der Nachricht