#include <algorithm>
#include <cctype>
-#include "math_inset.h"
-#include "math_arrayinset.h"
-#include "math_parser.h"
-#include "math_cursor.h"
-#include "math_macro.h"
-#include "math_macroarg.h"
-#include "math_macrotable.h"
-#include "math_root.h"
-#include "support/lstrings.h"
#include "debug.h"
#include "LColor.h"
#include "Painter.h"
-#include "math_matrixinset.h"
-#include "math_grid.h"
-#include "math_spaceinset.h"
-#include "math_funcinset.h"
+#include "mathed/support.h"
+#include "formulabase.h"
+#include "math_cursor.h"
+#include "math_arrayinset.h"
#include "math_bigopinset.h"
-#include "math_fracinset.h"
#include "math_decorationinset.h"
-#include "math_dotsinset.h"
#include "math_deliminset.h"
+#include "math_dotsinset.h"
+#include "math_fracinset.h"
+#include "math_funcinset.h"
+#include "math_gridinset.h"
+#include "math_macro.h"
+#include "math_macroarg.h"
+#include "math_macrotable.h"
#include "math_macrotemplate.h"
+#include "math_matrixinset.h"
+#include "math_rootinset.h"
+#include "math_spaceinset.h"
#include "math_sqrtinset.h"
+#include "support/lstrings.h"
#include "math_scriptinset.h"
-#include "mathed/support.h"
-#include "formulabase.h"
-
+#include "math_parser.h"
using std::endl;
using std::min;
{
return;
- lyxerr << "MC: " << what
- << " cursor.pos: " << cursor().pos_
- << " cursor.idx: " << cursor().idx_
- << " cursor.par: " << cursor().par_
- << " sel: " << selection
- << " data: " << array()
- << "\n";
+ lyxerr << "MC: " << what << "\n";
+ for (unsigned i = 0; i < Cursor_.size(); ++i)
+ lyxerr << " i: " << i
+ << " pos: " << Cursor_[i].pos_
+ << " idx: " << Cursor_[i].idx_
+ << " par: " << Cursor_[i].par_ << "\n";
+
+ //lyxerr << " sel: " << selection << " data: " << array() << "\n";
}
MathInset * p = prevInset();
if (openable(p, sel, false)) {
- array().prev(cursor().pos_);
+ plainLeft();
push(p, false);
return true;
}
- if (array().prev(cursor().pos_))
+ if (plainLeft())
return true;
if (cursor().par_->idxLeft(cursor().idx_, cursor().pos_))
return true;
if (openable(n, selection, true) && n->covers(x, y))
push(n, true);
else if (openable(p, selection, true) && p->covers(x, y)) {
- array().prev(cursor().pos_);
+ plainLeft();
push(p, false);
} else
break;
Delete();
}
-#ifdef WITH_WARNINGS
-#warning pullArg disabled
-#endif
- //if (cursor().pos_ == 0 && Cursor_.size() >= 1) {
- // lyxerr << "Delete: popping...\n";
- // pop();
- //}
-
dump("Delete 2");
}
if (p) {
int idx, pos;
if (p->idxLastUp(idx, pos)) {
- array().prev(cursor().pos_);
+ plainLeft();
push(p, false);
cursor().par_ = p;
cursor().idx_ = idx;
if (p) {
int idx, pos;
if (p->idxLastDown(idx, pos)) {
- array().prev(cursor().pos_);
+ plainLeft();
push(p, false);
cursor().idx_ = idx;
cursor().pos_ = pos;
if (!p) {
p = new MathScriptInset(true, false);
insert(p);
- array().prev(cursor().pos_);
+ plainLeft();
}
push(p, true);
p->up(true);
if (!p) {
p = new MathScriptInset(false, true);
insert(p);
- array().prev(cursor().pos_);
+ plainLeft();
}
push(p, true);
p->down(true);
p = new MathBigopInset(l->name, l->id);
break;
- case LM_TK_SYM:
- if (l->id < 255)
- insert(l->id, MathIsBOPS(l->id) ? LM_TC_BOPS : LM_TC_SYMB);
+ case LM_TK_SYM: {
+ MathTextCodes code = static_cast<MathTextCodes>(l->id);
+ if (code < 255)
+ insert(l->id, MathIsBOPS(code) ? LM_TC_BOPS : LM_TC_SYMB);
else
p = new MathFuncInset(l->name);
break;
+ }
case LM_TK_STACK:
p = new MathFracInset("stackrel");
SelCut();
insert(p);
if (p->nargs()) {
- array().prev(cursor().pos_);
+ plainLeft();
push(p, true);
if (oldsel)
SelPaste();
p->cell(0) = theSelection.glue();
}
insert(p);
+ plainLeft();
push(p, true);
}
void MathCursor::pullArg()
{
// pullArg
+ dump("pullarg");
MathArray a = array();
- if (!Left())
- return;
- normalize();
- array().erase(cursor().pos_);
- array().insert(cursor().pos_, a);
+ if (pop()) {
+ array().erase(cursor().pos_);
+ array().insert(cursor().pos_, a);
+ }
}