MathCursor::MathCursor(InsetFormulaBase * formula, bool left)
- : formula_(formula), lastcode_(LM_TC_VAR), selection_(false)
+ : formula_(formula), lastcode_(LM_TC_MIN), selection_(false)
{
left ? first() : last();
}
dump("Left 1");
if (inMacroMode()) {
macroModeClose();
- lastcode_ = LM_TC_VAR;
+ lastcode_ = LM_TC_MIN;
return true;
}
selHandle(sel);
- lastcode_ = LM_TC_VAR;
+ lastcode_ = LM_TC_MIN;
if (hasPrevAtom() && openable(prevAtom(), sel)) {
if (prevAtom()->isHyperActive()) {
dump("Right 1");
if (inMacroMode()) {
macroModeClose();
- lastcode_ = LM_TC_VAR;
+ lastcode_ = LM_TC_MIN;
return true;
}
selHandle(sel);
- lastcode_ = LM_TC_VAR;
+ lastcode_ = LM_TC_MIN;
if (hasNextAtom() && openable(nextAtom(), sel)) {
if (nextAtom()->isHyperActive()) {
dump("home 1");
selHandle(sel);
macroModeClose();
- lastcode_ = LM_TC_VAR;
+ lastcode_ = LM_TC_MIN;
if (!par()->idxHome(idx(), pos()))
popLeft();
dump("home 2");
dump("end 1");
selHandle(sel);
macroModeClose();
- lastcode_ = LM_TC_VAR;
+ lastcode_ = LM_TC_MIN;
if (!par()->idxEnd(idx(), pos()))
popRight();
dump("end 2");
}
-int MathCursor::macroNamePos() const
+MathInset::difference_type MathCursor::macroNamePos() const
{
- for (int i = pos() - 1; i >= 0; --i) {
+ for (MathInset::difference_type i = pos() - 1; i >= 0; --i) {
MathAtom & p = array().at(i);
if (p->code() == LM_TC_TEX && p->getChar() == '\\')
return i;
string MathCursor::macroName() const
{
string s;
- for (int i = macroNamePos(); i >= 0 && i < int(pos()); ++i)
+ MathInset::difference_type i = macroNamePos();
+ for ( ; i >= 0 && i < int(pos()); ++i)
s += array().at(i)->getChar();
return s;
}
MathGridInset * MathCursor::enclosingGrid(MathCursor::idx_type & idx) const
{
- for (int i = Cursor_.size() - 1; i >= 0; --i) {
+ for (MathInset::difference_type i = Cursor_.size() - 1; i >= 0; --i) {
MathGridInset * p = Cursor_[i].par_->asGridInset();
if (p) {
idx = Cursor_[i].idx_;
bool MathCursor::interpret(char c)
{
- //lyxerr << "interpret 2: '" << c << "'\n";
+
+ // Removed super/subscript handling from here to ::script -MV
+
// handle macroMode
if (inMacroMode()) {
string name = macroName();
}
// no special circumstances, so insert the character without any fuss
- insert(c, lastcode_);
+ insert(c, lastcode_ == LM_TC_MIN ? MathCharInset::nativeCode(c) : lastcode_);
lastcode_ = LM_TC_MIN;
return true;
}