[gnumeric] VLOOKUP/HLLOKUP/MATCH: Fix pattern matching.



commit 4fe728a9e0d41df21327cb7f38f67bbcd695b6e2
Author: Morten Welinder <terra gnome org>
Date:   Sun Mar 18 15:17:58 2012 -0400

    VLOOKUP/HLLOKUP/MATCH: Fix pattern matching.
    
    When there were holes in the data (blanks or wrong type), we we're
    not computing the right index.  We kept track of it properly, just
    didn't use it.

 NEWS                          |    1 +
 plugins/fn-lookup/ChangeLog   |    2 ++
 plugins/fn-lookup/functions.c |    2 +-
 3 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 43855bf..6b89bc9 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,7 @@ Morten:
 	* Fix INTERPOLATION crash.  [#672154]
 	* Inhibit typing underline style in format dialog.
 	* Allow pattern matching for VLOOKUP/HLOOKUP.  [#672319]
+	* Fix pattern matching for VLOOKUP/HLOOKUP/MATCH.
 
 --------------------------------------------------------------------------
 Gnumeric 1.11.2
diff --git a/plugins/fn-lookup/ChangeLog b/plugins/fn-lookup/ChangeLog
index e0019e4..f58fc8e 100644
--- a/plugins/fn-lookup/ChangeLog
+++ b/plugins/fn-lookup/ChangeLog
@@ -2,6 +2,8 @@
 
 	* functions.c (gnumeric_vlookup, gnumeric_hlookup): Handle string
 	search with patterns.  [#672319]
+	(wildcard_string_match): Return the index from the cache item.
+	That takes left-out cells into account.
 
 2012-03-02  Morten Welinder <terra gnome org>
 
diff --git a/plugins/fn-lookup/functions.c b/plugins/fn-lookup/functions.c
index e0af337..fa41905 100644
--- a/plugins/fn-lookup/functions.c
+++ b/plugins/fn-lookup/functions.c
@@ -588,7 +588,7 @@ wildcard_string_match (const char *key, LookupBisectionCacheItem *bc)
 
 	for (i = 0; i < bc->n; i++) {
 		if (go_regexec (&rx, bc->data[i].u.str, 1, &rm, 0) == GO_REG_OK) {
-			res = i;
+			res = bc->data[i].index;
 			break;
 		}
 	}



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