[evolution] I#318 - Search for 'previous' word in message preview behaves like 'next'



commit b66cdbbe6f33bcbfc12af52b788cf87f7c78c40b
Author: Milan Crha <mcrha redhat com>
Date:   Tue Feb 26 13:56:56 2019 +0100

    I#318 - Search for 'previous' word in message preview behaves like 'next'
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/318

 src/e-util/e-search-bar.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/e-util/e-search-bar.c b/src/e-util/e-search-bar.c
index 3c0a86d6bc..7177031ee3 100644
--- a/src/e-util/e-search-bar.c
+++ b/src/e-util/e-search-bar.c
@@ -191,12 +191,22 @@ search_bar_find (ESearchBar *search_bar,
                return;
        }
 
-       webkit_find_controller_search_finish (find_controller);
-       webkit_find_controller_search (
-               find_controller,
-               text,
-               case_sensitive ? WEBKIT_FIND_OPTIONS_NONE : WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE,
-               G_MAXUINT);
+       if (g_strcmp0 (webkit_find_controller_get_search_text (find_controller), text) == 0 &&
+           ((webkit_find_controller_get_options (find_controller) & WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE) != 
0 ? 1 : 0) ==
+           (case_sensitive ? 1 : 0)) {
+               if (search_forward)
+                       webkit_find_controller_search_next (find_controller);
+               else
+                       webkit_find_controller_search_previous (find_controller);
+       } else {
+               webkit_find_controller_search_finish (find_controller);
+               webkit_find_controller_search (
+                       find_controller,
+                       text,
+                       (case_sensitive ? WEBKIT_FIND_OPTIONS_NONE : WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE) |
+                       (search_forward ? 0 : WEBKIT_FIND_OPTIONS_BACKWARDS),
+                       G_MAXUINT);
+       }
 
        g_free (text);
 }


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