From: Jean-Marc Lasgouttes Date: Fri, 13 Apr 2012 11:03:59 +0000 (+0200) Subject: Revert "Fix undo of entering \hline" X-Git-Tag: 2.1.0beta1~1933^2~29 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=201dcc8ec3da924294ade6aefe801cf3bb3f2dc6;p=features.git Revert "Fix undo of entering \hline" This reverts commit 1fa39e1f953434700f1af4fb2eb9b193dd1709df. --- diff --git a/src/Cursor.cpp b/src/Cursor.cpp index be042940a0..7a13e1c3c9 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1599,11 +1599,8 @@ bool Cursor::macroModeClose() docstring const name = s.substr(1); InsetMathNest * const in = inset().asInsetMath()->asNestInset(); - if (in && in->interpretString(*this, s)) { - // end undo group that was opened before in was created - endUndoGroup(); + if (in && in->interpretString(*this, s)) return true; - } MathAtom atom = buffer()->getMacro(name, *this, false) ? MathAtom(new MathMacro(buffer(), name)) : createInsetMath(name, buffer()); @@ -1636,9 +1633,7 @@ bool Cursor::macroModeClose() else insert(selection); } - - // end undo group that was opened before in was created - endUndoGroup(); + return true; } diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 87f7d4b4f5..ed77f71f85 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -184,7 +184,6 @@ bool InsetMathGrid::interpretString(Cursor & cur, docstring const & str) FuncStatus status; if (getStatus(cur, fr, status)) { if (status.enabled()) { - cur.recordUndoInset(); rowinfo_[cur.row()].lines_++; return true; } diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 860d265e53..c2f4fc16ba 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -848,14 +848,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_SELF_INSERT: if (cmd.argument().size() != 1) { - // use a group because interpretString() might - // record an extra undo step - cur.beginUndoGroup(); cur.recordUndoSelection(); docstring const arg = cmd.argument(); if (!interpretString(cur, arg)) cur.insert(arg); - cur.endUndoGroup(); break; } // 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.plainInsert(MathAtom( new InsetMathBig(name.substr(1), delim))); - // end undo group that was opened before p was created - cur.endUndoGroup(); return true; } } @@ -1712,12 +1706,9 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c) bool reduced = cap::reduceSelectionToOneCell(cur); if (reduced || !cur.selection()) { docstring const safe = cap::grabAndEraseSelection(cur); - if (!cur.inRegexped()) { - // open a group because interpretString() might - // record an extra undo step when finalizing - cur.beginUndoGroup(); + if (!cur.inRegexped()) cur.insert(MathAtom(new InsetMathUnknown(from_ascii("\\"), safe, false))); - } else + else cur.niceInsert(createInsetMath("backslash", buf)); } return true; diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index a4a11bb136..8fcf7466e3 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -28,6 +28,8 @@ #include "CoordCache.h" #include "Cursor.h" +#include "mathed/InsetMathUnknown.h" + #include "support/debug.h" #include "support/docstream.h"