}
+bool Cursor::inCoordCache() const
+{
+ // the root inset is not in cache, but we do not need it.
+ if (depth() == 1)
+ return true;
+ CoordCache::Insets const & icache = bv_->coordCache().getInsets();
+ for (size_t i = 1 ; i < depth() ; ++i)
+ if (!icache.has(&(*this)[i].inset()))
+ return false;
+ return true;
+}
+
+
void Cursor::getPos(int & x, int & y) const
{
Point p = bv().getPos(*this);
}
- bool moved = (new_cur.pos() != pos()
- || new_cur.pit() != pit()
- || new_cur.boundary() != boundary()
- || &new_cur.inset() != &inset());
+ bool const moved = new_cur != *this || new_cur.boundary() != boundary();
if (moved) {
LYXERR(Debug::RTL, "moving to: " << new_cur.pos()
}
- bool moved = (new_cur.pos() != pos()
- || new_cur.pit() != pit()
- || new_cur.boundary() != boundary());
+ bool const moved = new_cur != *this || new_cur.boundary() != boundary();
if (moved) {
LYXERR(Debug::RTL, "moving to: " << new_cur.pos()
// LASSERT: There have been several bugs around this code, that seem
// to involve failures to reset the anchor. We can at least not crash
// in release mode by resetting it ourselves.
- LASSERT(anchor_.depth() >= depth(),
- const_cast<DocIterator &>(anchor_) = *this);
+ if (anchor_.depth() < depth()) {
+ LYXERR0("Cursor is deeper than anchor. PLEASE REPORT.\nCursor is"
+ << *this);
+ const_cast<DocIterator &>(anchor_) = *this;
+ }
CursorSlice normal = anchor_[depth() - 1];
if (depth() < anchor_.depth() && top() <= normal) {
++pos();
inset().setBuffer(bv_->buffer());
inset().initView();
- forceBufferUpdate();
+ checkBufferStructure();
}
// Make sure that cur gets back whatever happened to dummy (Lgb)
operator=(dummy);
}
+ if (inTexted() && pos() && paragraph().isEnvSeparator(pos() - 1))
+ posBackward();
} else {
// if there is a selection, we stay out of any inset,
// and just jump to the right position:
// In case the master has no gui associated with it,
// the TocItem is not updated (part of bug 5699).
buffer()->tocBackend().updateItem(*this);
+
+ // If the last tracked change of the paragraph has just been
+ // deleted, then we need to recompute the buffer flag
+ // tracked_changes_present_.
+ if (inTexted() && paragraph().isChangeUpdateRequired())
+ disp_.forceChangesUpdate();
}