[gnumeric] Number match: disallow fraction match for general cells.



commit 5397527409f587bb52c1be0b215b3340339dfd49
Author: Morten Welinder <terra gnome org>
Date:   Thu Dec 30 11:31:04 2010 -0500

    Number match: disallow fraction match for general cells.

 ChangeLog                    |   13 ++++++++++---
 NEWS                         |    1 +
 samples/numbermatch.gnumeric |  Bin 3450 -> 3514 bytes
 src/number-match.c           |    8 +++++---
 4 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 122096e..2d41320 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,15 @@
+2010-12-30  Morten Welinder  <terra gnome org>
+
+	* src/number-match.c (format_match_fraction): Add option for
+	accepting mixed-format numbers only.
+	(format_match): When the existing format is "General", allow only
+	mixed-format number.
+
 2010-12-26  Andreas J. Guelzow <aguelzow pyrshep ca>
 
-	* src/go-data-cache-field.c (go_data_cache_field_get_val): protect 
+	* src/go-data-cache-field.c (go_data_cache_field_get_val): protect
 	against crashes
-	
+
 2010-12-26  Jean Brefort  <jean brefort normalesup org>
 
 	* src/sheet-control-gui.c (scg_scale_changed): reposition sheet objects to
@@ -18,7 +25,7 @@
 	* src/commands.h (cmd_analysis_tool): add argument
 	* src/commands.c (cmd_analysis_tool): use always_take_ownership
 	  argument
-	
+
 2010-12-17  Jean Brefort  <jean brefort normalesup org>
 
 	* src/gnm-so-line.c (so_line_view_set_bounds): take zoom level into
diff --git a/NEWS b/NEWS
index a8de1af..17bb446 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ Morten:
 	* Fix array intersection problem with IF.  [#633433]
 	* Make sure columns are wide enough for dates in csv import.
 	* Plug a few leaks.
+	* Fix number-match issue regarding fraction.
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.12
diff --git a/samples/numbermatch.gnumeric b/samples/numbermatch.gnumeric
index 78d8c04..af24221 100644
Binary files a/samples/numbermatch.gnumeric and b/samples/numbermatch.gnumeric differ
diff --git a/src/number-match.c b/src/number-match.c
index 23de694..48dbf38 100644
--- a/src/number-match.c
+++ b/src/number-match.c
@@ -854,7 +854,7 @@ format_match_datetime (char const *text,
  * The number of digits in the denominator is stored in @denlen.
  */
 static GnmValue *
-format_match_fraction (char const *text, int *denlen)
+format_match_fraction (char const *text, int *denlen, gboolean mixed_only)
 {
 	char sign = 0;
 	gnm_float whole, num, den, f;
@@ -874,6 +874,8 @@ format_match_fraction (char const *text, int *denlen)
 	SKIP_SPACES (text);
 
 	if (*text == '/') {
+		if (mixed_only)
+			return NULL;
 		whole = 0;
 	} else {
 		whole = gnm_strto (start, NULL);
@@ -1215,7 +1217,7 @@ format_match (char const *text, GOFormat const *cur_fmt,
 	}
 
 	case GO_FORMAT_FRACTION:
-		v = format_match_fraction (text, &denlen);
+		v = format_match_fraction (text, &denlen, FALSE);
 		if (!v)
 			v = format_match_decimal_number (text, &fam);
 		if (!v)
@@ -1263,7 +1265,7 @@ format_match (char const *text, GOFormat const *cur_fmt,
 	if (v)
 		return v;
 
-	v = format_match_fraction (text, &denlen);
+	v = format_match_fraction (text, &denlen, TRUE);
 	if (v) {
 		char fmtstr[20];
 		char const *qqq = "?????" + 5;



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