[gnumeric] ssdiff: ignore completely empty cells.



commit d33be90b9ad0b521aeec7f4a0ea912889016f944
Author: Morten Welinder <terra gnome org>
Date:   Fri Dec 28 10:40:33 2012 -0500

    ssdiff: ignore completely empty cells.

 ChangeLog    |    1 +
 src/ssdiff.c |   18 +++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a9192e6..d5b42f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
 	* src/sheet-style.c (sheet_style_range_foreach): Move handling of
 	range offset here.  This may need to move further.
 	* src/ssdiff.c (cb_diff_sheets_styles_2): From here.
+	(diff_sheets_cells): Ignore completely empty cells.
 
 2012-12-27  Morten Welinder  <terra gnome org>
 
diff --git a/src/ssdiff.c b/src/ssdiff.c
index cdc9019..29b22e0 100644
--- a/src/ssdiff.c
+++ b/src/ssdiff.c
@@ -366,7 +366,14 @@ compare_corresponding_cells (GnmCell const *co, GnmCell const *cn)
 
 	return FALSE;
 }
-      
+
+static gboolean
+ignore_cell (GnmCell const *cell)
+{
+	return cell &&
+		!gnm_cell_has_expr (cell) &&
+		VALUE_IS_EMPTY (cell->value);
+}             
 
 static void
 diff_sheets_cells (GnmDiffState *state, Sheet *old_sheet, Sheet *new_sheet)
@@ -380,8 +387,13 @@ diff_sheets_cells (GnmDiffState *state, Sheet *old_sheet, Sheet *new_sheet)
 	g_ptr_array_add (new_cells, NULL);
 
 	while (TRUE) {
-		GnmCell const *co = g_ptr_array_index (old_cells, io);
-		GnmCell const *cn = g_ptr_array_index (new_cells, in);
+		GnmCell const *co, *cn;
+
+		while (ignore_cell ((co = g_ptr_array_index (old_cells, io))))
+			io++;
+
+		while (ignore_cell ((cn = g_ptr_array_index (new_cells, in))))
+			in++;
 
 		if (co && cn) {
 			int order = co->pos.row == cn->pos.row



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