[gnumeric] Sheet: fix issue with row/column delete and names touching the end.



commit 7af87879118b6dff8d2f9f44195d5c2cf63071b2
Author: Morten Welinder <terra gnome org>
Date:   Tue Dec 16 21:01:35 2014 -0500

    Sheet: fix issue with row/column delete and names touching the end.

 ChangeLog   |    5 +++++
 src/sheet.c |   31 ++++++++++++++++++-------------
 2 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e6ab00e..f466db1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-16  Morten Welinder  <terra gnome org>
+
+       * src/sheet.c (sheet_insdel_colrow): Fix "sticky-end" setting for
+       the delete case.
+
 2014-12-15  Morten Welinder  <terra gnome org>
 
        * src/sheet-style.c (sheet_style_insdel_colrow): Rename from
diff --git a/src/sheet.c b/src/sheet.c
index 4b97bf2..7222eb0 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -5022,7 +5022,7 @@ sheet_insdel_colrow (Sheet *sheet, int pos, int count,
        sheet_objects_clear (sheet, &kill_zone, G_TYPE_NONE, pundo);
 
        reloc_info.reloc_type = is_cols ? GNM_EXPR_RELOCATE_COLS : GNM_EXPR_RELOCATE_ROWS;
-       reloc_info.sticky_end = is_insert || kill_end > last_pos;
+       reloc_info.sticky_end = is_insert || !(kill_end > last_pos);
        reloc_info.origin_sheet = reloc_info.target_sheet = sheet;
        parse_pos_init_sheet (&reloc_info.pos, sheet);
 
@@ -5030,21 +5030,26 @@ sheet_insdel_colrow (Sheet *sheet, int pos, int count,
        sheet_style_clear_style_dependents (sheet, &change_zone);
 
        /* 3. Invalidate references to kill zone.  */
-       reloc_info.origin = kill_zone;
-       reloc_info.col_offset = is_cols ? last_pos + 1 : 0;  /* Force invalidation */
-       reloc_info.row_offset = is_cols ? 0 : last_pos + 1;
-       combine_undo (pundo, dependents_relocate (&reloc_info));
+       if (is_insert) {
+               /* Done in the next step. */
+       } else {
+               reloc_info.origin = kill_zone;
+               /* Force invalidation: */
+               reloc_info.col_offset = is_cols ? last_pos + 1 : 0;
+               reloc_info.row_offset = is_cols ? 0 : last_pos + 1;
+               combine_undo (pundo, dependents_relocate (&reloc_info));
+       }
 
-       /* 3. Fix references to the cells which are moving */
-       reloc_info.origin = move_zone;
+       /* 4. Fix references to the cells which are moving */
+       reloc_info.origin = is_insert ? change_zone : move_zone;
        reloc_info.col_offset = is_cols ? scount : 0;
        reloc_info.row_offset = is_cols ? 0 : scount;
        combine_undo (pundo, dependents_relocate (&reloc_info));
 
-       /* 4. Move the cells */
+       /* 5. Move the cells */
        sheet_cells_deps_move (&reloc_info);
 
-       /* 5. Move the columns/rows to their new location.  */
+       /* 6. Move the columns/rows to their new location.  */
        if (is_insert) {
                /* From right to left */
                for (i = max_used_pos; i >= pos ; --i)
@@ -5058,16 +5063,16 @@ sheet_insdel_colrow (Sheet *sheet, int pos, int count,
        sheet_colrow_set_collapse (sheet, is_cols,
                                   is_insert ? pos + count : last_pos - (count - 1));
 
-       /* 6. Move formatting.  */
+       /* 7. Move formatting.  */
        sheet_style_insdel_colrow (&reloc_info);
 
-       /* 7. Move objects.  */
+       /* 8. Move objects.  */
        sheet_objects_relocate (&reloc_info, FALSE, pundo);
 
-       /* 8. Move merges.  */
+       /* 9. Move merges.  */
        gnm_sheet_merge_relocate (&reloc_info);
 
-       /* 9. Move filters.  */
+       /* 10. Move filters.  */
        gnm_sheet_filter_insdel_colrow (sheet, is_cols, is_insert, pos, count, pundo);
 
        /* Notify sheet of pending updates */


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