[gnumeric] Conditional format: fix "contains".



commit d66e132fd0f800d815b4628d2b23d3739e509d8c
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 21 11:34:36 2014 -0400

    Conditional format: fix "contains".
    
    1. Case insensitive.
    2. Allow wildcards like SEARCH.

 ChangeLog              |    3 +++
 src/style-conditions.c |    5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4a41187..0c889c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-03-21  Morten Welinder  <terra gnome org>
 
+       * src/style-conditions.c (gnm_style_cond_eval): Make "Contains..."
+       case insensitve and allow wildcards.
+
        * src/gutils.c (gnm_excel_search_impl): New function, extracted
        from fn-string.
 
diff --git a/src/style-conditions.c b/src/style-conditions.c
index 438b9e3..b9f5e2a 100644
--- a/src/style-conditions.c
+++ b/src/style-conditions.c
@@ -609,8 +609,9 @@ gnm_style_cond_eval (GnmStyleCond const *cond, GnmValue const *cv,
                negate = TRUE;  /* ...and fall through */
        case GNM_STYLE_COND_CONTAINS_STR:
                res = (cv &&
-                      strstr (value_peek_string (cv),
-                              value_peek_string (val0)) != NULL);
+                      gnm_excel_search_impl (value_peek_string (val0),
+                                             value_peek_string (cv),
+                                             0) >= 0);
                break;
 
        case GNM_STYLE_COND_NOT_BEGINS_WITH_STR:


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