From 838af80834ac38c231ff080acc3a6d60ad664ede Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 8 Dec 2010 09:24:04 +0000 Subject: [PATCH] Try to finally fix #6930. All the paths that did not come from context menus were (intentionally) missing, and it turns out they were needed. Normally all invocations of INSET_MODIFY should trigger a recordUndo now. Of course all cases have not been tested, but it should be working. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36770 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetBibitem.cpp | 3 +++ src/insets/InsetBibtex.cpp | 3 ++- src/insets/InsetBox.cpp | 2 +- src/insets/InsetBranch.cpp | 2 ++ src/insets/InsetCommand.cpp | 4 +++- src/insets/InsetERT.cpp | 1 + src/insets/InsetExternal.cpp | 1 + src/insets/InsetFloat.cpp | 1 + src/insets/InsetGraphics.cpp | 1 + src/insets/InsetInclude.cpp | 1 + src/insets/InsetIndex.cpp | 1 + src/insets/InsetLabel.cpp | 4 +++- src/insets/InsetLine.cpp | 1 + src/insets/InsetListings.cpp | 1 + src/insets/InsetNomencl.cpp | 2 ++ src/insets/InsetTabular.cpp | 2 +- src/insets/InsetWrap.cpp | 1 + src/mathed/InsetMathRef.cpp | 1 + 18 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp index 11ba38c7e8..d3a10ae63c 100644 --- a/src/insets/InsetBibitem.cpp +++ b/src/insets/InsetBibitem.cpp @@ -122,6 +122,9 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd) cur.noScreenUpdate(); break; } + + cur.recordUndo(); + docstring const & old_key = params()["key"]; docstring const & old_label = params()["label"]; docstring label = p["label"]; diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 88ff664967..f61e1661a5 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -103,7 +103,8 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd) throw message; break; } - // + + cur.recordUndo(); setParams(p); buffer().invalidateBibfileCache(); cur.forceBufferUpdate(); diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 6b409200bf..16839b01cb 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -192,8 +192,8 @@ void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { //lyxerr << "InsetBox::dispatch MODIFY" << endl; + cur.recordUndoInset(ATOMIC_UNDO, this); if (cmd.getArg(0) == "changetype") { - cur.recordUndoInset(ATOMIC_UNDO, this); params_.type = cmd.getArg(1); } else string2params(to_utf8(cmd.argument()), params_); diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index 7bb1b65555..4bcd711c1b 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -116,6 +116,8 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { InsetBranchParams params; InsetBranch::string2params(to_utf8(cmd.argument()), params); + + cur.recordUndoInset(ATOMIC_UNDO, this); params_.branch = params.branch; // what we really want here is a TOC update, but that means // a full buffer update diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp index 4da3f19b2b..601e5a7b47 100644 --- a/src/insets/InsetCommand.cpp +++ b/src/insets/InsetCommand.cpp @@ -156,8 +156,10 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd) InsetCommand::string2params(to_utf8(cmd.argument()), p); if (p.getCmdName().empty()) cur.noScreenUpdate(); - else + else { + cur.recordUndo(); setParams(p); + } // FIXME We might also want to check here if this one is in the TOC. // But I think most of those are labeled. if (isLabeled()) diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp index 61b3128ffb..c65b54b977 100644 --- a/src/insets/InsetERT.cpp +++ b/src/insets/InsetERT.cpp @@ -114,6 +114,7 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd) switch (cmd.action()) { case LFUN_INSET_MODIFY: if (cmd.getArg(0) == "ert") { + cur.recordUndoInset(ATOMIC_UNDO, this); setStatus(cur, string2params(to_utf8(cmd.argument()))); break; } diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index f8b8a9bd65..78d7de47a2 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -420,6 +420,7 @@ void InsetExternal::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { InsetExternalParams p; string2params(to_utf8(cmd.argument()), buffer(), p); + cur.recordUndo(); setParams(p); break; } diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index 6654123dab..2292d175c9 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -142,6 +142,7 @@ void InsetFloat::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { InsetFloatParams params; string2params(to_utf8(cmd.argument()), params); + cur.recordUndoInset(ATOMIC_UNDO, this); // placement, wide and sideways are not used for subfloats if (!params_.subfloat) { diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 25abe040d6..3bbf19f3b1 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -210,6 +210,7 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd) break; } + cur.recordUndo(); setParams(p); // if the inset is part of a graphics group, all the // other members should be updated too. diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index b852f4b259..c91a70eeb5 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -277,6 +277,7 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd) } } } + cur.recordUndo(); setParams(p); cur.forceBufferUpdate(); } else diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 455f683c64..32419a408a 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -213,6 +213,7 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd) } InsetIndexParams params; InsetIndex::string2params(to_utf8(cmd.argument()), params); + cur.recordUndoInset(ATOMIC_UNDO, this); params_.index = params.index; // what we really want here is a TOC update, but that means // a full buffer update diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp index 926297e56f..62476dea76 100644 --- a/src/insets/InsetLabel.cpp +++ b/src/insets/InsetLabel.cpp @@ -196,8 +196,10 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd) cur.noScreenUpdate(); break; } - if (p["name"] != params()["name"]) + if (p["name"] != params()["name"]) { + // undo is handled in updateCommand updateCommand(p["name"]); + } cur.forceBufferUpdate(); break; } diff --git a/src/insets/InsetLine.cpp b/src/insets/InsetLine.cpp index 5c12d37e09..a91a31ed5e 100644 --- a/src/insets/InsetLine.cpp +++ b/src/insets/InsetLine.cpp @@ -77,6 +77,7 @@ void InsetLine::doDispatch(Cursor & cur, FuncRequest & cmd) cur.noScreenUpdate(); break; } + cur.recordUndo(); setParams(p); break; } diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index f03cace45f..7b37e05941 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -320,6 +320,7 @@ void InsetListings::doDispatch(Cursor & cur, FuncRequest & cmd) switch (cmd.action()) { case LFUN_INSET_MODIFY: { + cur.recordUndoInset(ATOMIC_UNDO, this); InsetListings::string2params(to_utf8(cmd.argument()), params()); break; } diff --git a/src/insets/InsetNomencl.cpp b/src/insets/InsetNomencl.cpp index 1a44ccd5f8..a596691aa3 100644 --- a/src/insets/InsetNomencl.cpp +++ b/src/insets/InsetNomencl.cpp @@ -175,6 +175,8 @@ void InsetPrintNomencl::doDispatch(Cursor & cur, FuncRequest & cmd) cur.noScreenUpdate(); break; } + + cur.recordUndo(); setParams(p); break; } diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 0a0a9097b3..c41cea76c1 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -5114,7 +5114,7 @@ void InsetTabular::tabularFeatures(Cursor & cur, break; } - cur.recordUndoInset(ATOMIC_UNDO); + cur.recordUndoInset(ATOMIC_UNDO, this); getSelection(cur, sel_row_start, sel_row_end, sel_col_start, sel_col_end); row_type const row = tabular.cellRow(cur.idx()); diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp index f29c06ee97..a3eca3c5a2 100644 --- a/src/insets/InsetWrap.cpp +++ b/src/insets/InsetWrap.cpp @@ -80,6 +80,7 @@ void InsetWrap::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action()) { case LFUN_INSET_MODIFY: { + cur.recordUndoInset(ATOMIC_UNDO, this); InsetWrapParams params; InsetWrap::string2params(to_utf8(cmd.argument()), params); params_.lines = params.lines; diff --git a/src/mathed/InsetMathRef.cpp b/src/mathed/InsetMathRef.cpp index 4485304a9f..ae1768351c 100644 --- a/src/mathed/InsetMathRef.cpp +++ b/src/mathed/InsetMathRef.cpp @@ -66,6 +66,7 @@ void InsetMathRef::doDispatch(Cursor & cur, FuncRequest & cmd) if (cmd.getArg(0) == "ref") { MathData ar; if (createInsetMath_fromDialogStr(cmd.argument(), ar)) { + cur.recordUndo(); *this = *ar[0].nucleus()->asRefInset(); break; }