]> git.lyx.org Git - features.git/commitdiff
Do not record undo in the tabularFeatures helper
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 8 Feb 2016 17:19:24 +0000 (18:19 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 9 Feb 2016 08:18:56 +0000 (09:18 +0100)
Since the low-level version of tabular features is only called by the high-level one, it does not make sense to record undo there. It is much better to do it once in the high-level handler, rather than 37 times (yes!) at lower level when the tabular GUI calls tabular-feature with all the settings at once.

With large tables, this avoids to keep 37 copies of the table in Undo stack.

As an added bonus, this fixes bug #9960.

src/insets/InsetTabular.cpp
src/insets/InsetTabular.h

index 2d967bcc3f2b4f0cb4ebf032bd66f838d20ff63c..6d8f7d0737138f45d5a1b6183e0290c2f96b66d9 100644 (file)
@@ -5335,6 +5335,8 @@ void InsetTabular::movePrevCell(Cursor & cur, EntryDirection entry_from)
 
 void InsetTabular::tabularFeatures(Cursor & cur, string const & argument)
 {
+       cur.recordUndoInset(this);
+
        istringstream is(argument);
        string s;
        // Safe guard.
@@ -5461,8 +5463,6 @@ void InsetTabular::tabularFeatures(Cursor & cur,
                break;
        }
 
-       cur.recordUndoInset(this);
-
        getSelection(cur, sel_row_start, sel_row_end, sel_col_start, sel_col_end);
        row_type const row = tabular.cellRow(cur.idx());
        col_type const column = tabular.cellColumn(cur.idx());
index 026489d1559a80b35e12d1b075394ea27635887d..de664f15be2af1694a7b7aee81baf157f3b814ac 100644 (file)
@@ -903,9 +903,9 @@ public:
        /// get offset of this cursor slice relative to our upper left corner
        void cursorPos(BufferView const & bv, CursorSlice const & sl,
                bool boundary, int & x, int & y) const;
-       ///
+       /// Executes a space-separated sequence of tabular-features requests
        void tabularFeatures(Cursor & cur, std::string const & what);
-       ///
+       /// Change a single tabular feature; does not handle undo.
        void tabularFeatures(Cursor & cur, Tabular::Feature feature,
                             std::string const & val = std::string());
        /// number of cells