// create a macro if we see "\\newcommand"
// somewhere, and an ordinary formula
// otherwise
+ istringstream is(sel);
if (sel.find("\\newcommand") == string::npos
&& sel.find("\\def") == string::npos)
{
- cur.insert(new MathHullInset("simple"));
- cur.dispatch(FuncRequest(LFUN_RIGHT));
- cur.dispatch(FuncRequest(LFUN_INSERT_MATH, sel));
- } else {
- istringstream is(sel);
+ MathHullInset * formula = new MathHullInset;
+ LyXLex lex(0, 0);
+ lex.setStream(is);
+ formula->read(cur.buffer(), lex);
+ if (formula->getType() == "none")
+ // Don't create pseudo formulas if
+ // delimiters are left out
+ formula->mutate("simple");
+ cur.insert(formula);
+ } else
cur.insert(new MathMacroTemplate(is));
- }
}
cur.message(N_("Math editor mode"));
}
if (cur.depth() == 1) {
if (!cur.mark())
cur.clearSelection();
- cursorTop(cur);
+ needsUpdate = cursorTop(cur);
finishChange(cur, false);
} else {
cur.undispatched();
if (cur.depth() == 1) {
if (!cur.selection())
cur.resetAnchor();
- cursorTop(cur);
+ needsUpdate = cursorTop(cur);
finishChange(cur, true);
} else {
cur.undispatched();
if (cur.depth() == 1) {
if (!cur.mark())
cur.clearSelection();
- cursorBottom(cur);
+ needsUpdate = cursorBottom(cur);
finishChange(cur, false);
} else {
cur.undispatched();
if (cur.depth() == 1) {
if (!cur.selection())
cur.resetAnchor();
- cursorBottom(cur);
+ needsUpdate = cursorBottom(cur);
finishChange(cur, true);
} else {
cur.undispatched();
update(cur);
if (!cur.selection())
cur.resetAnchor();
- cursorPrevious(cur);
+ needsUpdate = cursorPrevious(cur);
finishChange(cur, true);
break;
update(cur);
if (!cur.selection())
cur.resetAnchor();
- cursorNext(cur);
+ needsUpdate = cursorNext(cur);
finishChange(cur, true);
break;
update(cur);
if (!cur.selection())
cur.resetAnchor();
- cursorHome(cur);
+ needsUpdate = cursorHome(cur);
finishChange(cur, true);
break;
update(cur);
if (!cur.selection())
cur.resetAnchor();
- cursorEnd(cur);
+ needsUpdate = cursorEnd(cur);
finishChange(cur, true);
break;
case LFUN_HOME:
if (!cur.mark())
cur.clearSelection();
- cursorHome(cur);
+ needsUpdate = cursorHome(cur);
finishChange(cur, false);
break;
case LFUN_END:
if (!cur.mark())
cur.clearSelection();
- cursorEnd(cur);
+ needsUpdate = cursorEnd(cur);
finishChange(cur, false);
break;
case LFUN_DELETE:
if (!cur.selection()) {
+ if (cur.pos() == cur.paragraph().size())
+ // Par boundary, force full-screen update
+ singleParUpdate = false;
needsUpdate = Delete(cur);
cur.resetAnchor();
// It is possible to make it a lot faster still
// just comment out the line below...
} else {
cutSelection(cur, true, false);
+ singleParUpdate = false;
}
moveCursor(cur, false);
break;
case LFUN_BACKSPACE:
if (!cur.selection()) {
if (bv->owner()->getIntl().getTransManager().backspace()) {
+ // Par boundary, full-screen update
+ if (cur.pos() == 0)
+ singleParUpdate = false;
needsUpdate = backspace(cur);
cur.resetAnchor();
// It is possible to make it a lot faster still
}
} else {
cutSelection(cur, true, false);
+ singleParUpdate = false;
}
bv->switchKeyMap();
break;
if (singleParUpdate)
// Inserting characters does not change par height
- if (cur.bottom().paragraph().dim().height()
+ if (cur.bottom().paragraph().dim().height()
== olddim.height()) {
// if so, update _only_ this paragraph
- cur.bv().update(Update::SinglePar | Update::Force);
+ cur.bv().update(Update::SinglePar |
+ Update::FitCursor |
+ Update::MultiParSel);
+ cur.noUpdate();
+ return;
} else
needsUpdate = true;
if (!needsUpdate