Show search match count also if highlight is off.
authorDaniel Carl <danielcarl@gmx.de>
Wed, 31 Aug 2016 21:15:33 +0000 (23:15 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 31 Aug 2016 21:41:37 +0000 (23:41 +0200)
src/command.c
src/main.c
src/main.h

index 9af68f4..2ba4c62 100644 (file)
@@ -37,10 +37,10 @@ gboolean command_search(const Arg *arg)
     gboolean forward;
 
     if (arg->i == 0) {
-#ifdef FEATURE_SEARCH_HIGHLIGHT
-        webkit_web_view_unmark_text_matches(vb.gui.webview);
         vb.state.search_matches = 0;
         vb_update_statusbar();
+#ifdef FEATURE_SEARCH_HIGHLIGHT
+        webkit_web_view_unmark_text_matches(vb.gui.webview);
 #endif
         newsearch = true;
         return true;
@@ -64,15 +64,16 @@ gboolean command_search(const Arg *arg)
     if (query) {
         unsigned int count = abs(arg->i);
         if (newsearch) {
-#ifdef FEATURE_SEARCH_HIGHLIGHT
+            vb.state.search_matches = webkit_web_view_mark_text_matches(vb.gui.webview, query, false, 0);
+            vb_update_statusbar();
+            newsearch = false;
+
             /* highlight matches if the search is started new or continued
              * after switch to normal mode which calls this function with
              * COMMAND_SEARCH_OFF */
-            vb.state.search_matches = webkit_web_view_mark_text_matches(vb.gui.webview, query, false, 0);
+#ifdef FEATURE_SEARCH_HIGHLIGHT
             webkit_web_view_set_highlight_text_matches(vb.gui.webview, true);
-            vb_update_statusbar();
 #endif
-            newsearch = false;
             /* skip first search because this is done during typing in ex
              * mode, else the search will mark the next match as active */
             if (count) {
index 3218d71..09ed4d9 100644 (file)
@@ -478,12 +478,10 @@ void vb_update_statusbar()
         g_string_append_printf(status, " %d %s", num, num == 1 ? "download" : "downloads");
     }
 
-#ifdef FEATURE_SEARCH_HIGHLIGHT
     /* show the number of matches search results */
     if (vb.state.search_matches) {
         g_string_append_printf(status, " (%d)", vb.state.search_matches);
     }
-#endif
 
     /* show load status of page or the downloads */
     if (vb.state.progress != 100) {
index f1fbd40..0ba07c5 100644 (file)
@@ -305,9 +305,7 @@ typedef struct {
     gboolean        enable_register;        /* indicates if registers are filled */
     char            current_register;       /* holds char for current register to be used */
     gboolean        typed;                  /* indicates if th euser type the keys processed as command */
-#ifdef FEATURE_SEARCH_HIGHLIGHT
     int             search_matches;         /* number of matches search results */
-#endif
     char            *fifo_path;             /* holds the path to the control fifo */
     char            *socket_path;           /* holds the path to the control socket */
     char            *pid_str;               /* holds the pid as string */