mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
don't crash on C-m
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8884 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
943d71e5aa
commit
aa8fa8e243
@ -25,6 +25,7 @@
|
||||
#include "math_parser.h"
|
||||
#include "math_scriptinset.h"
|
||||
#include "math_spaceinset.h"
|
||||
#include "math_symbolinset.h"
|
||||
#include "math_support.h"
|
||||
#include "math_unknowninset.h"
|
||||
|
||||
@ -1006,6 +1007,9 @@ bool MathNestInset::interpret(LCursor & cur, char c)
|
||||
} 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());
|
||||
@ -1088,15 +1092,15 @@ bool MathNestInset::interpret(LCursor & cur, char c)
|
||||
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))
|
||||
|
@ -854,13 +854,13 @@ void LyXText::updateCounters()
|
||||
}
|
||||
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
|
||||
|
14
src/text3.C
14
src/text3.C
@ -137,7 +137,9 @@ namespace {
|
||||
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
|
||||
@ -351,8 +353,10 @@ void doInsertInset(LCursor & cur, LyXText * text,
|
||||
gotsel = true;
|
||||
}
|
||||
text->insertInset(cur, inset);
|
||||
|
||||
if (edit)
|
||||
inset->edit(cur, true);
|
||||
|
||||
if (gotsel && pastesel)
|
||||
cur.bv().owner()->dispatch(FuncRequest(LFUN_PASTE));
|
||||
}
|
||||
@ -792,8 +796,10 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_INSET_INSERT: {
|
||||
recordUndo(cur);
|
||||
InsetBase * inset = createInset(bv, cmd);
|
||||
if (inset)
|
||||
if (inset) {
|
||||
insertInset(cur, inset);
|
||||
cur.posRight();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1031,8 +1037,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
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, "\""));
|
||||
@ -1275,11 +1282,13 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// 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:
|
||||
@ -1289,6 +1298,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_INSERT_PAGEBREAK:
|
||||
// do nothing fancy
|
||||
doInsertInset(cur, this, cmd, false, false);
|
||||
cur.posRight();
|
||||
break;
|
||||
|
||||
case LFUN_DEPTH_MIN:
|
||||
|
Loading…
Reference in New Issue
Block a user