in the text.
* src/insets/insetbase.h (notifyCursorLeaves): return a bool
indicating whether cursor is invalidated.
* src/mathed/math_nestinset.C (notifyCursorLeaves):
* src/mathed/math_hullinset.C (notifyCursorLeaves): adapt to
prototype change.
* src/mathed/math_scriptinset.[Ch] (notifyCursorLeaves): return
true when an inset has been deleted.
* src/BufferView.C (mouseSetCursor): do not call dEPM when cursor
is invalidated by notifyCursorLeaves.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14796
a592a061-630c-0410-9148-
cb99ea01b6c8
BOOST_ASSERT(&cur.bv() == this);
// Has the cursor just left the inset?
+ bool badcursor = false;
if (&cursor().inset() != &cur.inset())
- cursor().inset().notifyCursorLeaves(cursor());
+ badcursor = cursor().inset().notifyCursorLeaves(cursor());
// do the dEPM magic if needed
- if (cursor().inTexted())
+ // FIXME: move this to InsetText::notifyCursorLeaves?
+ if (!badcursor && cursor().inTexted())
cursor().text()->deleteEmptyParagraphMechanism(cur, cursor());
cursor() = cur;
/// number of columns in gridlike structures
virtual size_t ncols() const { return 0; }
/// is called when the cursor leaves this inset
- virtual void notifyCursorLeaves(LCursor &) {}
+ // returns true if cursor is now invalid.
+ virtual bool notifyCursorLeaves(LCursor &) { return false; }
/// request "external features"
virtual void validate(LaTeXFeatures &) const {}
}
-void MathHullInset::notifyCursorLeaves(LCursor & cur)
+bool MathHullInset::notifyCursorLeaves(LCursor & cur)
{
if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
Buffer const & buffer = cur.buffer();
preview_->addPreview(snippet, buffer);
preview_->startLoading(buffer);
}
+ return false;
}
OutputParams const &) const;
/// get notification when the cursor leaves this inset
- void notifyCursorLeaves(LCursor & cur);
+ bool notifyCursorLeaves(LCursor & cur);
///
//bool insetAllowed(Code code) const;
///
}
-void MathNestInset::notifyCursorLeaves(LCursor & /*cur*/)
+bool MathNestInset::notifyCursorLeaves(LCursor & /*cur*/)
{
#ifdef WITH_WARNINGS
#warning look here
}
}
#endif
+ return false;
}
/// access to the lock
void lock(bool);
/// get notification when the cursor leaves this inset
- void notifyCursorLeaves(LCursor & cur);
+ bool notifyCursorLeaves(LCursor & cur);
/// direct access to the cell
MathArray & cell(idx_type);
}
-void MathScriptInset::notifyCursorLeaves(LCursor & cur)
+bool MathScriptInset::notifyCursorLeaves(LCursor & cur)
{
MathNestInset::notifyCursorLeaves(cur);
// must be a subscript...
recordUndoInset(cur);
removeScript(false);
+ return true;
} else if (cur.idx() == 1 && cell(1).empty()) {
// must be a superscript...
recordUndoInset(cur);
removeScript(true);
+ return true;
}
} else if (nargs() > 1 && cur.idx() == 1 && cell(1).empty()) {
// could be either subscript or super script
tmpcur.pop();
tmpcur.cell().erase(tmpcur.pos());
tmpcur.cell().insert(tmpcur.pos(), ar);
+ return true;
}
//lyxerr << "MathScriptInset::notifyCursorLeaves: 2 " << cur << endl;
+ return false;
}
int ndes() const;
/// where do we have to draw the scripts?
bool hasLimits() const;
- /// clean up empty cells
- void notifyCursorLeaves(LCursor & cur);
+ /// clean up empty cells and return true if a cell has been deleted.
+ bool notifyCursorLeaves(LCursor & cur);
/// possible subscript (index 0) and superscript (index 1)
bool cell_1_is_up_;