mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
* update the words of a paragraph when the cursor leaves.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23260 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5622f4b560
commit
249e6b7ac0
@ -1773,6 +1773,15 @@ bool notifyCursorLeaves(Cursor const & old, Cursor & cur)
|
||||
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
|
||||
for (; i < old.depth(); ++i) {
|
||||
|
@ -2746,6 +2746,7 @@ void Paragraph::registerWords()
|
||||
|
||||
void Paragraph::updateWords(Buffer const & buf, CursorSlice const & sl)
|
||||
{
|
||||
BOOST_ASSERT(&sl.paragraph() == this);
|
||||
deregisterWords();
|
||||
collectWords(buf, sl);
|
||||
registerWords();
|
||||
|
@ -474,6 +474,25 @@ void InsetText::updateLabels(Buffer const & buf, ParIterator const & it)
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
|
@ -137,6 +137,8 @@ public:
|
||||
virtual void updateLabels(Buffer const &, ParIterator const &);
|
||||
///
|
||||
virtual Inset * clone() const;
|
||||
///
|
||||
virtual bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
|
||||
|
||||
///
|
||||
bool completionSupported(Cursor const &) const;
|
||||
|
Loading…
Reference in New Issue
Block a user