fix x^1<space>_

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2876 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-10-12 15:38:58 +00:00
parent 400fcfa1ee
commit db033af700
4 changed files with 37 additions and 6 deletions

View File

@ -16,6 +16,7 @@
#include <fstream> #include <fstream>
#include "Lsstream.h" #include "Lsstream.h"
#include "support/LAssert.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -641,10 +642,11 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
result = UNDISPATCHED; result = UNDISPATCHED;
} }
lyx::Assert(mathcursor);
//mathcursor->normalize(); //mathcursor->normalize();
if (was_macro != mathcursor->inMacroMode() if (//was_macro != mathcursor->inMacroMode() &&
&& action >= 0 && action != LFUN_BACKSPACE) action >= 0 && action != LFUN_BACKSPACE)
updateLocal(bv, true); updateLocal(bv, true);
if (mathcursor->selection() || was_selection) if (mathcursor->selection() || was_selection)

View File

@ -132,9 +132,10 @@ MathCursor::MathCursor(InsetFormulaBase * formula, bool left)
void MathCursor::push(MathAtom & t) void MathCursor::push(MathAtom & t)
{ {
//cerr << "Entering atom "; t->write(cerr, false); cerr << " left\n";
MathCursorPos p; MathCursorPos p;
p.par_ = &t; p.par_ = &t;
p.idx_ = 0;
p.pos_ = 0;
Cursor_.push_back(p); Cursor_.push_back(p);
} }
@ -937,7 +938,10 @@ void MathCursor::normalize() const
if (pos() > size()) { if (pos() > size()) {
lyxerr << "this should not really happen - 2: " lyxerr << "this should not really happen - 2: "
<< pos() << " " << size() << "\n"; << pos() << " " << size() << " in idx: " << it->idx()
<< " in atom: '";
it->par()->write(lyxerr, false);
lyxerr << "\n";
dump("error 4"); dump("error 4");
} }
it->pos() = min(pos(), size()); it->pos() = min(pos(), size());
@ -1321,17 +1325,22 @@ void MathCursor::interpret(char c)
if (hasPrevAtom() && prevAtom()->asScriptInset()) { if (hasPrevAtom() && prevAtom()->asScriptInset()) {
prevAtom()->asScriptInset()->ensure(up); prevAtom()->asScriptInset()->ensure(up);
pushRight(prevAtom()); pushRight(prevAtom());
idx() = up;
pos() = size(); pos() = size();
} else if (hasNextAtom() && nextAtom()->asScriptInset()) { } else if (hasNextAtom() && nextAtom()->asScriptInset()) {
nextAtom()->asScriptInset()->ensure(up); nextAtom()->asScriptInset()->ensure(up);
pushLeft(nextAtom()); pushLeft(nextAtom());
idx() = up;
pos() = 0; pos() = 0;
} else { } else {
plainInsert(MathAtom(new MathScriptInset(up))); plainInsert(MathAtom(new MathScriptInset(up)));
prevAtom()->asScriptInset()->ensure(up);
pushRight(prevAtom()); pushRight(prevAtom());
idx() = up;
pos() = 0;
} }
idx() = up;
selPaste(); selPaste();
dump("1");
return; return;
} }
@ -1393,7 +1402,6 @@ void MathCursor::interpret(char c)
else else
insert(c, LM_TC_VAR); insert(c, LM_TC_VAR);
#warning greek insert problem? look here!
if (lastcode_ == LM_TC_GREEK1) if (lastcode_ == LM_TC_GREEK1)
lastcode_ = LM_TC_VAR; lastcode_ = LM_TC_VAR;
return; return;

View File

@ -294,3 +294,19 @@ bool MathScriptInset::hasDown() const
{ {
return script_[0]; return script_[0];
} }
bool MathScriptInset::idxRight(MathInset::idx_type &,
MathInset::pos_type &) const
{
return false;
}
bool MathScriptInset::idxLeft(MathInset::idx_type &,
MathInset::pos_type &) const
{
return false;
}

View File

@ -40,6 +40,11 @@ public:
/// ///
int width(MathInset const * nucleus) const; int width(MathInset const * nucleus) const;
///
bool idxLeft(MathInset::idx_type &, MathInset::pos_type &) const;
///
bool idxRight(MathInset::idx_type &, MathInset::pos_type &) const;
/// ///
MathScriptInset const * asScriptInset() const; MathScriptInset const * asScriptInset() const;
/// ///