Record undo properly when inserting math script

The current code did not always record undo at the right level.

Fixes bug #10843.
This commit is contained in:
Jean-Marc Lasgouttes 2021-01-13 11:41:29 +01:00
parent 22efd5a5ef
commit 86191314cb

View File

@ -898,7 +898,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
if (cmd.argument().empty()) {
// do superscript if LyX handles
// deadkeys
cur.recordUndoSelection();
cur.recordUndoInset();
script(cur, true, grabAndEraseSelection(cur));
}
break;
@ -1874,10 +1874,12 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
return true;
} else if (currentMode() != InsetMath::TEXT_MODE) {
if (c == '_') {
cur.recordUndoInset();
script(cur, false, save_selection);
return true;
}
if (c == '^') {
cur.recordUndoInset();
script(cur, true, save_selection);
return true;
}