Revert "Fix undo of entering \hline"

This reverts commit 1fa39e1f95.
This commit is contained in:
Jean-Marc Lasgouttes 2012-04-13 13:03:59 +02:00
parent 88d9fc574e
commit 201dcc8ec3
4 changed files with 6 additions and 19 deletions

View File

@ -1599,11 +1599,8 @@ bool Cursor::macroModeClose()
docstring const name = s.substr(1); docstring const name = s.substr(1);
InsetMathNest * const in = inset().asInsetMath()->asNestInset(); InsetMathNest * const in = inset().asInsetMath()->asNestInset();
if (in && in->interpretString(*this, s)) { if (in && in->interpretString(*this, s))
// end undo group that was opened before in was created
endUndoGroup();
return true; return true;
}
MathAtom atom = buffer()->getMacro(name, *this, false) ? MathAtom atom = buffer()->getMacro(name, *this, false) ?
MathAtom(new MathMacro(buffer(), name)) : createInsetMath(name, buffer()); MathAtom(new MathMacro(buffer(), name)) : createInsetMath(name, buffer());
@ -1636,9 +1633,7 @@ bool Cursor::macroModeClose()
else else
insert(selection); insert(selection);
} }
// end undo group that was opened before in was created
endUndoGroup();
return true; return true;
} }

View File

@ -184,7 +184,6 @@ bool InsetMathGrid::interpretString(Cursor & cur, docstring const & str)
FuncStatus status; FuncStatus status;
if (getStatus(cur, fr, status)) { if (getStatus(cur, fr, status)) {
if (status.enabled()) { if (status.enabled()) {
cur.recordUndoInset();
rowinfo_[cur.row()].lines_++; rowinfo_[cur.row()].lines_++;
return true; return true;
} }

View File

@ -848,14 +848,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_SELF_INSERT: case LFUN_SELF_INSERT:
if (cmd.argument().size() != 1) { if (cmd.argument().size() != 1) {
// use a group because interpretString() might
// record an extra undo step
cur.beginUndoGroup();
cur.recordUndoSelection(); cur.recordUndoSelection();
docstring const arg = cmd.argument(); docstring const arg = cmd.argument();
if (!interpretString(cur, arg)) if (!interpretString(cur, arg))
cur.insert(arg); cur.insert(arg);
cur.endUndoGroup();
break; break;
} }
// Don't record undo steps if we are in macro mode and thus // Don't record undo steps if we are in macro mode and thus
@ -1667,8 +1663,6 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
cur.cell().erase(cur.pos()); cur.cell().erase(cur.pos());
cur.plainInsert(MathAtom( cur.plainInsert(MathAtom(
new InsetMathBig(name.substr(1), delim))); new InsetMathBig(name.substr(1), delim)));
// end undo group that was opened before p was created
cur.endUndoGroup();
return true; return true;
} }
} }
@ -1712,12 +1706,9 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
bool reduced = cap::reduceSelectionToOneCell(cur); bool reduced = cap::reduceSelectionToOneCell(cur);
if (reduced || !cur.selection()) { if (reduced || !cur.selection()) {
docstring const safe = cap::grabAndEraseSelection(cur); docstring const safe = cap::grabAndEraseSelection(cur);
if (!cur.inRegexped()) { if (!cur.inRegexped())
// open a group because interpretString() might
// record an extra undo step when finalizing
cur.beginUndoGroup();
cur.insert(MathAtom(new InsetMathUnknown(from_ascii("\\"), safe, false))); cur.insert(MathAtom(new InsetMathUnknown(from_ascii("\\"), safe, false)));
} else else
cur.niceInsert(createInsetMath("backslash", buf)); cur.niceInsert(createInsetMath("backslash", buf));
} }
return true; return true;

View File

@ -28,6 +28,8 @@
#include "CoordCache.h" #include "CoordCache.h"
#include "Cursor.h" #include "Cursor.h"
#include "mathed/InsetMathUnknown.h"
#include "support/debug.h" #include "support/debug.h"
#include "support/docstream.h" #include "support/docstream.h"