if (&old[i].inset() != &cur[i].inset())
break;
}
+
+ // update words if we just moved to another paragraph
+ if (i == old.depth() && i == cur.depth()
+ && !cur.buffer().isClean()
+ && cur.inTexted() && old.inTexted()
+ && cur.pit() != old.pit()) {
+ old.paragraph().updateWords(old.buffer(), old.top());
+ return false;
+ }
// notify everything on top of the common part in old cursor,
// but stop if the inset claims the cursor to be invalid now
void Paragraph::updateWords(Buffer const & buf, CursorSlice const & sl)
{
+ BOOST_ASSERT(&sl.paragraph() == this);
deregisterWords();
collectWords(buf, sl);
registerWords();
}
+bool InsetText::notifyCursorLeaves(Cursor const & old, Cursor & cur)
+{
+ if (cur.buffer().isClean())
+ return Inset::notifyCursorLeaves(old, cur);
+
+ // find text inset in old cursor
+ Cursor insetCur = old;
+ int scriptSlice = insetCur.find(this);
+ BOOST_ASSERT(scriptSlice != -1);
+ insetCur.cutOff(scriptSlice);
+ BOOST_ASSERT(&insetCur.inset() == this);
+
+ // update the old paragraph's words
+ insetCur.paragraph().updateWords(insetCur.buffer(), insetCur.top());
+
+ return Inset::notifyCursorLeaves(old, cur);
+}
+
+
bool InsetText::completionSupported(Cursor const & cur) const
{
Cursor const & bvCur = cur.bv().cursor();
virtual void updateLabels(Buffer const &, ParIterator const &);
///
virtual Inset * clone() const;
+ ///
+ virtual bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
///
bool completionSupported(Cursor const &) const;