- BOOST_ASSERT(!empty());
- if (pos() == lastpos())
- return 0;
- if (pos() > lastpos()) {
- lyxerr << "Should not happen, but it does. " << endl;
- return 0;
+ LASSERT(buffer->isClone(), return DocIterator());
+ Inset * inset = &buffer->inset();
+ DocIterator dit(buffer);
+ size_t const n = slices_.size();
+ for (size_t i = 0 ; i != n; ++i) {
+ LASSERT(inset, /**/);
+ dit.push_back(slices_[i]);
+ dit.top().inset_ = inset;
+ if (i + 1 != n)
+ inset = dit.nextInset();