#include "math_parser.h"
#include "math_scriptinset.h"
#include "math_spaceinset.h"
+#include "math_symbolinset.h"
#include "math_support.h"
#include "math_unknowninset.h"
} else if (c == '{') {
cur.backspace();
cur.niceInsert(MathAtom(new MathBraceInset));
+ } else if (c == '%') {
+ cur.backspace();
+ cur.niceInsert(MathAtom(new MathSymbolInset("%")));
} else if (c == '#') {
lyxerr << "setting name to " << name + c << endl;
BOOST_ASSERT(cur.activeMacro());
return true;
}
- if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#') {
+ if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%') {
cur.niceInsert(createMathInset(string(1, c)));
return true;
}
- if (c == '%') {
- cur.niceInsert(MathAtom(new MathCommentInset));
- return true;
- }
+ //if (c == '%') {
+ // cur.niceInsert(MathAtom(new MathCommentInset));
+ // return true;
+ //}
// try auto-correction
//if (autocorrect() && hasPrevAtom() && math_autocorrect(prevAtom(), c))
}
+// this really should just inset the inset and not move the cursor.
void LyXText::insertInset(LCursor & cur, InsetBase * inset)
{
BOOST_ASSERT(this == cur.text());
BOOST_ASSERT(inset);
cur.paragraph().insertInset(cur.pos(), inset);
redoParagraph(cur);
- setCursor(cur, cur.par(), cur.pos() + 1, false, cur.boundary());
}
lyxerr << "selection is: '" << sel << "'" << endl;
if (sel.empty()) {
+ const int old_pos = cur.pos();
cur.insert(new MathHullInset);
+ BOOST_ASSERT(old_pos == cur.pos());
cur.nextInset()->edit(cur, true);
cur.dispatch(FuncRequest(LFUN_MATH_MUTATE, "simple"));
// don't do that also for LFUN_MATH_MODE unless you want end up with
gotsel = true;
}
text->insertInset(cur, inset);
+
if (edit)
inset->edit(cur, true);
+
if (gotsel && pastesel)
cur.bv().owner()->dispatch(FuncRequest(LFUN_PASTE));
}
case LFUN_INSET_INSERT: {
recordUndo(cur);
InsetBase * inset = createInset(bv, cmd);
- if (inset)
+ if (inset) {
insertInset(cur, inset);
+ cur.posRight();
+ }
break;
}
cur.insert(new InsetQuotes(c,
bufparams.quotes_language,
InsetQuotes::DoubleQ));
- else
+ else
cur.insert(new InsetQuotes(c, bufparams));
+ cur.posRight();
}
else
bv->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
// Open the inset, and move the current selection
// inside it.
doInsertInset(cur, this, cmd, true, true);
+ cur.posRight();
break;
case LFUN_INDEX_INSERT:
// Just open the inset
doInsertInset(cur, this, cmd, true, false);
+ cur.posRight();
break;
case LFUN_INDEX_PRINT:
case LFUN_INSERT_PAGEBREAK:
// do nothing fancy
doInsertInset(cur, this, cmd, false, false);
+ cur.posRight();
break;
case LFUN_DEPTH_MIN: