mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Simpler fix for undo support when entering \hline in an equation
* Avoid undo step when using backspace in macro mode * Use recordUndoInset when entering macro mode (if one enters something like \hline, the outer inset itself will be modified) * Use recordUndoInset when pasting in an INsetMathGrid (same reason as above)
This commit is contained in:
parent
201dcc8ec3
commit
9059843121
@ -1356,7 +1356,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
hline_enabled = status.enabled();
|
||||
if (grid.nargs() == 1) {
|
||||
// single cell/part of cell
|
||||
cur.recordUndo();
|
||||
cur.recordUndoInset();
|
||||
cur.cell().insert(cur.pos(), grid.cell(0));
|
||||
cur.pos() += grid.cell(0).size();
|
||||
if (hline_enabled)
|
||||
|
@ -806,7 +806,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (cur.pos() == 0)
|
||||
// May affect external cell:
|
||||
cur.recordUndoInset();
|
||||
else
|
||||
else if (!cur.inMacroMode())
|
||||
cur.recordUndoSelection();
|
||||
// if the inset can not be removed from within, delete it
|
||||
if (!cur.backspace()) {
|
||||
@ -1705,6 +1705,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
||||
//lyxerr << "starting with macro" << endl;
|
||||
bool reduced = cap::reduceSelectionToOneCell(cur);
|
||||
if (reduced || !cur.selection()) {
|
||||
cur.recordUndoInset();
|
||||
docstring const safe = cap::grabAndEraseSelection(cur);
|
||||
if (!cur.inRegexped())
|
||||
cur.insert(MathAtom(new InsetMathUnknown(from_ascii("\\"), safe, false)));
|
||||
|
Loading…
Reference in New Issue
Block a user