fix crashs discovered by Michael

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3984 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-04-12 13:30:14 +00:00
parent 5a4fe1be41
commit 4025b11bc4
4 changed files with 10 additions and 32 deletions

View File

@ -373,11 +373,6 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
if (!mathcursor)
return UNDISPATCHED;
if (mathcursor->asHyperActiveInset()) {
lyxerr << " uurr.... getting dificult now\n";
return mathcursor->asHyperActiveInset()->localDispatch(bv, action, arg);
}
RESULT result = DISPATCHED;
bool sel = false;
bool was_macro = mathcursor->inMacroMode();

View File

@ -249,12 +249,6 @@ bool MathCursor::popRight()
#endif
UpdatableInset * MathCursor::asHyperActiveInset() const
{
return par()->asHyperActiveInset();
}
bool MathCursor::isInside(MathInset const * p) const
{
for (unsigned i = 0; i < Cursor_.size(); ++i)
@ -266,9 +260,6 @@ bool MathCursor::isInside(MathInset const * p) const
bool MathCursor::openable(MathAtom const & t, bool sel) const
{
if (t->isHyperActive())
return true;
if (!t->isActive())
return false;
@ -316,9 +307,6 @@ bool MathCursor::left(bool sel)
lastcode_ = LM_TC_MIN;
if (hasPrevAtom() && openable(prevAtom(), sel)) {
if (prevAtom()->isHyperActive()) {
lyxerr << "entering hyperactive inset\n";
}
pushRight(prevAtom());
return true;
}
@ -339,12 +327,6 @@ bool MathCursor::right(bool sel)
lastcode_ = LM_TC_MIN;
if (hasNextAtom() && openable(nextAtom(), sel)) {
if (nextAtom()->isHyperActive()) {
lyxerr << "entering hyperactive inset\n";
int x, y;
getPos(x, y);
nextAtom()->edit(formula()->view(), x, y, 0);
}
pushLeft(nextAtom());
return true;
}
@ -982,12 +964,14 @@ void MathCursor::normalize()
pos() = min(pos(), size());
// remove empty scripts if possible
for (pos_type i = 0; i < size(); ++i) {
MathScriptInset * p = array().at(i)->asScriptInset();
if (p) {
p->removeEmptyScripts();
if (p->empty())
array().erase(i);
if (1) {
for (pos_type i = 0; i < size(); ++i) {
MathScriptInset * p = array().at(i)->asScriptInset();
if (p) {
p->removeEmptyScripts();
//if (p->empty())
// array().erase(i);
}
}
}

View File

@ -105,6 +105,8 @@ MathArray::iterator extractArgument(MathArray & ar,
MathScriptInset const * asScript(MathArray::const_iterator it)
{
if (!it->nucleus())
return 0;
if (it->nucleus()->asScriptInset())
return 0;
++it;

View File

@ -204,14 +204,11 @@ public:
virtual MathSymbolInset const * asSymbolInset() const { return 0; }
virtual MathUnknownInset const * asUnknownInset() const { return 0; }
virtual MathXYMatrixInset const* asXYMatrixInset() const{ return 0; }
virtual UpdatableInset * asHyperActiveInset() const { return 0; }
/// identifies things that can get scripts
virtual bool isScriptable() const { return false; }
/// thing that can be moved into
virtual bool isActive() const { return nargs() > 0; }
/// identifies insets from the outer world
virtual bool isHyperActive() const { return 0; }
/// is the a relational operator (used for splitting equations)
virtual bool isRelOp() const { return false; }