fix super/subscript crash

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8393 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2004-02-03 14:29:00 +00:00
parent 14d27fe324
commit 7ffc9e9175
4 changed files with 19 additions and 25 deletions

View File

@ -303,7 +303,8 @@ void LCursor::getPos(int & x, int & y) const
// inset.yo_, so getCursor() returns an old value.
// Ugly as you like.
}
lyxerr << "#### LCursor::getPos: x: " << x << " y: " << y << endl;
//lyxerr << "#### LCursor::getPos: " << *this
// << " x: " << x << " y: " << y << endl;
}
@ -1313,7 +1314,7 @@ void LCursor::normalize()
<< idx() << ' ' << nargs()
<< " in: " << inset() << endl;
}
idx() = min(idx(), nargs() - 1);
idx() = min(idx(), lastidx());
if (pos() > lastpos()) {
lyxerr << "this should not really happen - 2: "
@ -1537,22 +1538,22 @@ bool LCursor::script(bool up)
idx() = up;
pos() = 0;
} else if (pos() != 0 && prevAtom()->asScriptInset()) {
prevAtom().nucleus()->asScriptInset()->ensure(up);
posLeft();
push(inset());
--pos();
nextAtom().nucleus()->asScriptInset()->ensure(up);
push(nextInset());
idx() = up;
pos() = lastpos();
} else if (pos() != 0) {
--pos();
cell()[pos()] = MathAtom(new MathScriptInset(nextAtom(), up));
push(inset());
push(nextInset());
idx() = up;
pos() = 0;
} else {
plainInsert(MathAtom(new MathScriptInset(up)));
posLeft();
--pos();
nextAtom().nucleus()->asScriptInset()->ensure(up);
push(inset());
push(nextInset());
idx() = up;
pos() = 0;
}
@ -1563,7 +1564,7 @@ bool LCursor::script(bool up)
bool LCursor::interpret(char c)
{
lyxerr << "interpret 2: '" << c << "'" << endl;
//lyxerr << "interpret 2: '" << c << "'" << endl;
clearTargetX();
if (inMacroArgMode()) {
posLeft();

View File

@ -162,13 +162,7 @@ void LyXFunc::handleKeyFunc(kb_action action)
void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
{
string argument;
if (lyxerr.debugging(Debug::KEY)) {
lyxerr << "KeySym is "
<< keysym->getSymbolName()
<< endl;
}
lyxerr[Debug::KEY] << "KeySym is " << keysym->getSymbolName() << endl;
// Do nothing if we have nothing (JMarc)
if (!keysym->isOK()) {
@ -254,9 +248,11 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
if (encoded_last_key != 0) {
string arg;
arg += encoded_last_key;
lyxerr << "SelfInsert arg[`"
<< arg << "']" << endl;
dispatch(FuncRequest(LFUN_SELFINSERT, arg));
lyxerr[Debug::KEY] << "SelfInsert arg[`"
<< argument << "']" << endl;
lyxerr[Debug::KEY]
<< "SelfInsert arg[`" << arg << "']" << endl;
}
} else {
dispatch(func);

View File

@ -314,8 +314,8 @@ int MathArray::pos2x(size_type pos, int glue) const
const_iterator it = begin() + i;
if ((*it)->getChar() == ' ')
x += glue;
lyxerr << "char: " << (*it)->getChar()
<< "width: " << (*it)->width() << std::endl;
//lyxerr << "char: " << (*it)->getChar()
// << "width: " << (*it)->width() << std::endl;
x += (*it)->width();
}
return x;

View File

@ -79,9 +79,6 @@ void MathNestInset::getCursorPos(CursorSlice const & cur,
// move cursor visually into empty cells ("blue rectangles");
if (cur.cell().empty())
x += 2;
lyxerr << "MathNestInset::getCursorPos: cur: " << cur
<< " x: " << x << " y: " << y << endl;
BOOST_ASSERT(x < 100000);
}
@ -103,7 +100,7 @@ void MathNestInset::metrics(MetricsInfo const & mi) const
bool MathNestInset::idxNext(LCursor & cur) const
{
BOOST_ASSERT(cur.inset() == this);
if (cur.idx() + 1 >= nargs())
if (cur.idx() == cur.lastidx())
return false;
++cur.idx();
cur.pos() = 0;
@ -150,7 +147,7 @@ bool MathNestInset::idxLast(LCursor & cur) const
BOOST_ASSERT(cur.inset() == this);
if (nargs() == 0)
return false;
cur.idx() = nargs() - 1;
cur.idx() = cur.lastidx();
cur.pos() = cur.lastpos();
return true;
}