mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
* another try on http://bugzilla.lyx.org/show_bug.cgi?id=4566:
"Eqnarray multiple cells size change erases what they contain" We also apply LFUN_MATH_INSERT to every selected cell if a single math inset is inserted. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23804 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
224fb0b4b5
commit
aad4651830
@ -412,15 +412,14 @@ void InsetMathNest::handleFont
|
||||
void InsetMathNest::handleFont(Cursor & cur, docstring const & arg,
|
||||
docstring const & font)
|
||||
{
|
||||
cur.recordUndoSelection();
|
||||
|
||||
// this whole function is a hack and won't work for incremental font
|
||||
// changes...
|
||||
|
||||
if (cur.inset().asInsetMath()->name() == font) {
|
||||
cur.recordUndoInset();
|
||||
if (cur.inset().asInsetMath()->name() == font)
|
||||
cur.handleFont(to_utf8(font));
|
||||
} else {
|
||||
else
|
||||
handleNest(cur, createInsetMath(font), arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -439,7 +438,6 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest,
|
||||
return;
|
||||
if (i1.idx() == i2.idx()) {
|
||||
// the easy case where only one cell is selected
|
||||
cur.recordUndo();
|
||||
cur.handleNest(nest);
|
||||
cur.insert(arg);
|
||||
return;
|
||||
@ -447,7 +445,6 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest,
|
||||
|
||||
// multiple selected cells in a simple non-grid inset
|
||||
if (i1.asInsetMath()->nrows() == 0 || i1.asInsetMath()->ncols() == 0) {
|
||||
cur.recordUndoInset();
|
||||
for (idx_type i = i1.idx(); i <= i2.idx(); ++i) {
|
||||
// select cell
|
||||
cur.idx() = i;
|
||||
@ -469,7 +466,6 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest,
|
||||
}
|
||||
|
||||
// the complicated case with multiple selected cells in a grid
|
||||
cur.recordUndoInset();
|
||||
row_type r1, r2;
|
||||
col_type c1, c2;
|
||||
cap::region(i1, i2, r1, r2, c1, c2);
|
||||
@ -497,7 +493,7 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest,
|
||||
|
||||
void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
{
|
||||
cur.recordUndo();
|
||||
cur.recordUndoSelection();
|
||||
Font font;
|
||||
bool b;
|
||||
font.fromString(to_utf8(arg), b);
|
||||
@ -1073,10 +1069,16 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// math-insert only handles special math things like "matrix".
|
||||
case LFUN_MATH_INSERT: {
|
||||
cur.recordUndoSelection();
|
||||
if (cmd.argument() == "^" || cmd.argument() == "_") {
|
||||
if (cmd.argument() == "^" || cmd.argument() == "_")
|
||||
interpretChar(cur, cmd.argument()[0]);
|
||||
} else
|
||||
cur.niceInsert(cmd.argument());
|
||||
else {
|
||||
MathData ar;
|
||||
asArray(cmd.argument(), ar);
|
||||
if (ar.size() == 1 && ar[0]->asNestInset())
|
||||
handleNest(cur, ar[0]);
|
||||
else
|
||||
cur.niceInsert(cmd.argument());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user