[gnumeric] Array expression: Don't double-undo col widths and row heights.



commit a296a6cacd21b6404119469b1ddd3fba2b884448
Author: Morten Welinder <terra gnome org>
Date:   Sun May 6 18:22:18 2018 -0400

    Array expression: Don't double-undo col widths and row heights.
    
    That happens to fix 795861.

 ChangeLog      |    5 +++++
 src/commands.c |   30 ++++--------------------------
 2 files changed, 9 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d406834..7da4579 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-06  Morten Welinder  <terra gnome org>
+
+       * src/commands.c (cmd_area_set_array_expr): The clipboard now
+       takes care of restoring row heights and column widths.
+
 2018-05-04  Morten Welinder  <terra gnome org>
 
        * src/wbc-gtk.c (toolbar_context_menu): Use a proper separator
diff --git a/src/commands.c b/src/commands.c
index cef0e4c..871d4fe 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -1056,6 +1056,7 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
                                (r->start.col, r->end.col, cri_col_list);
                }
        }
+
        undo = go_undo_combine (undo,
                                gnm_undo_colrow_restore_state_group_new
                                (sheet, TRUE,
@@ -1069,7 +1070,6 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
                                 colrow_get_sizes (sheet, FALSE,
                                                   cri_row_list, -1)));
 
-
        result = cmd_generic (wbc, text, undo, redo);
        g_free (text);
        range_fragment_free (selection);
@@ -1157,9 +1157,7 @@ cmd_area_set_array_expr (WorkbookControl *wbc, SheetView *sv,
        char *name;
        char *text;
        GnmSheetRange *sr;
-       GnmRange *r_1, *r_2, *r;
-       ColRowIndexList *cri_col_list;
-       ColRowIndexList *cri_row_list;
+       GnmRange *r;
 
        g_return_val_if_fail (selection != NULL , TRUE);
        g_return_val_if_fail (selection->next == NULL , TRUE);
@@ -1170,39 +1168,19 @@ cmd_area_set_array_expr (WorkbookControl *wbc, SheetView *sv,
 
        r = selection->data;
 
-       cri_row_list = colrow_get_index_list
-               (r->start.row, r->end.row, NULL);
-       cri_col_list = colrow_get_index_list
-               (r->start.col, r->end.col, NULL);
        undo = clipboard_copy_range_undo (sheet, selection->data);
-       undo = go_undo_combine (undo,
-                               gnm_undo_colrow_restore_state_group_new
-                               (sheet, TRUE,
-                                cri_col_list,
-                                colrow_get_sizes (sheet, TRUE,
-                                                  cri_col_list, -1)));
-       undo = go_undo_combine (undo,
-                               gnm_undo_colrow_restore_state_group_new
-                               (sheet, FALSE,
-                                cri_row_list,
-                                colrow_get_sizes (sheet, FALSE,
-                                                  cri_row_list, -1)));
 
        sr = gnm_sheet_range_new (sheet, r);
-       r_1 = g_new (GnmRange, 1);
-       *r_1 = *r;
-       r_2 = g_new (GnmRange, 1);
-       *r_2 = *r;
        redo = gnm_cell_set_array_formula_undo (sr, texpr);
        redo = go_undo_combine
                (go_undo_binary_new
-                (sheet, r_1,
+                (sheet, g_memdup (r, sizeof (*r)),
                  (GOUndoBinaryFunc) colrow_autofit_col,
                  NULL, g_free),
                 redo);
        redo  = go_undo_combine
                (go_undo_binary_new
-                (sheet, r_2,
+                (sheet, g_memdup (r, sizeof (*r)),
                  (GOUndoBinaryFunc) colrow_autofit_row,
                  NULL, g_free),
                 redo);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]