}
-void MathNestInset::getCursorPos(CursorSlice const & sl,
+void MathNestInset::cursorPos(CursorSlice const & sl, bool boundary,
int & x, int & y) const
{
// FIXME: This is a hack. Ideally, the coord cache should not store
break;
case LFUN_FINISHED_DOWN:
+ ++cur.pos();
cur.bv().cursor() = cur;
break;
} else if (cur.posRight() || idxRight(cur)
|| cur.popRight() || cur.selection())
;
- else
+ else {
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
+ cur.undispatched();
+ }
break;
case LFUN_LEFTSEL:
} else if (cur.posLeft() || idxLeft(cur)
|| cur.popLeft() || cur.selection())
;
- else
+ else {
cmd = FuncRequest(LFUN_FINISHED_LEFT);
+ cur.undispatched();
+ }
break;
case LFUN_UPSEL:
break;
}
cur.selHandle(cmd.action == LFUN_UPSEL);
- if (!cur.up())
+ if (!cur.up()) {
cmd = FuncRequest(LFUN_FINISHED_UP);
+ cur.undispatched();
+ }
// fixes bug 1598. Please check!
cur.normalize();
break;
break;
}
cur.selHandle(cmd.action == LFUN_DOWNSEL);
- if (!cur.down())
+ if (!cur.down()) {
cmd = FuncRequest(LFUN_FINISHED_DOWN);
+ cur.undispatched();
+ }
// fixes bug 1598. Please check!
cur.normalize();
break;
cur.insert(cmd.argument);
break;
}
- if (!interpret(cur, cmd.argument[0]))
+ if (!interpret(cur, cmd.argument[0])) {
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
+ cur.undispatched();
+ }
break;
//case LFUN_GETXY:
handleFont(cur, cmd.argument, "mathrm");
break;
case LFUN_CODE:
+ if (currentMode() == TEXT_MODE)
handleFont(cur, cmd.argument, "texttt");
+ else
+ handleFont(cur, cmd.argument, "mathtt");
break;
case LFUN_FRAK:
handleFont(cur, cmd.argument, "mathfrak");
}
flag.setOnOff(cmd.argument[0] == align);
break;
+#endif
+ /// We have to handle them since 1.4 blocks all unhandled actions
+ case LFUN_ITAL:
case LFUN_BOLD:
- flag.setOnOff(tc == "mathbf");
- break;
case LFUN_SANS:
- flag.setOnOff(tc == "mathsf");
- break;
case LFUN_EMPH:
- flag.setOnOff(tc == "mathcal");
- break;
- case LFUN_ROMAN:
- flag.setOnOff(tc == "mathrm");
- break;
case LFUN_CODE:
- flag.setOnOff(tc == "mathtt");
- break;
case LFUN_NOUN:
- flag.setOnOff(tc == "mathbb");
- break;
+ case LFUN_ROMAN:
case LFUN_DEFAULT:
- flag.setOnOff(tc == "mathnormal");
+ flag.enabled(true);
break;
-#endif
case LFUN_MATH_MUTATE:
//flag.setOnOff(mathcursor::formula()->hullType() == cmd.argument);
flag.setOnOff(false);
cur.idx() = left ? 0 : cur.lastidx();
cur.pos() = left ? 0 : cur.lastpos();
cur.resetAnchor();
- lyxerr << "MathNestInset::edit, cur:\n" << cur << endl;
+ //lyxerr << "MathNestInset::edit, cur:\n" << cur << endl;
}
cur.push(*this);
cur.idx() = idx_min;
cur.pos() = ar.x2pos(x - ar.xo());
- lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
+ //lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
if (dist_min == 0) {
// hit inside cell
for (pos_type i = 0, n = ar.size(); i < n; ++i)
bool MathNestInset::interpret(LCursor & cur, char c)
{
- lyxerr << "interpret 2: '" << c << "'" << endl;
+ //lyxerr << "interpret 2: '" << c << "'" << endl;
cur.clearTargetX();
// handle macroMode
script(cur, false);
return true;
}
-
if (c == '^') {
script(cur, true);
return true;
}
}
- if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%') {
+ if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%'
+ || c == '_' || c == '^') {
cur.niceInsert(createMathInset(string(1, c)));
return true;
}
// convert the thing to our left to a scriptinset or create a new
// one if in the very first position of the array
if (cur.pos() == 0) {
- lyxerr << "new scriptinset" << endl;
+ //lyxerr << "new scriptinset" << endl;
cur.insert(new MathScriptInset(up));
} else {
- lyxerr << "converting prev atom " << endl;
+ //lyxerr << "converting prev atom " << endl;
cur.prevAtom() = MathAtom(new MathScriptInset(cur.prevAtom(), up));
}
--cur.pos();
cur.idx() = 1;
cur.pos() = 0;
}
- lyxerr << "pasting 1: safe:\n" << safe << endl;
+ //lyxerr << "pasting 1: safe:\n" << safe << endl;
cur.paste(safe);
cur.resetAnchor();
- lyxerr << "pasting 2: safe:\n" << safe << endl;
+ //lyxerr << "pasting 2: safe:\n" << safe << endl;
return true;
}