From 0f246791f338a8cea98f8dbd9c179e7594535467 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Sat, 27 Jul 2013 12:24:17 +0200
Subject: [PATCH] Don't pollute the global count for search query.

No there is a own count variable used for search, so that we don't print the
default 1 to the statubar, if the user hasn't requested this. By the way also
requested counts are reset if there was no item found.
---
 src/command.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/command.c b/src/command.c
index 89c45bc..418bf1d 100644
--- a/src/command.c
+++ b/src/command.c
@@ -593,6 +593,7 @@ gboolean command_search(const Arg *arg)
     forward = !(arg->i ^ dir);
 
     if (query) {
+        int count;
 #ifdef FEATURE_SEARCH_HIGHLIGHT
         if (!highlight) {
             /* highlight matches if the search is started new or continued
@@ -607,14 +608,16 @@ gboolean command_search(const Arg *arg)
 #endif
 
         /* make sure we have a count greater than 0 */
-        vb.state.count = vb.state.count ? vb.state.count : 1;
+        count = vb.state.count ? vb.state.count : 1;
         do {
             if (!webkit_web_view_search_text(vb.gui.webview, query, false, forward, true)) {
                 break;
             }
-        } while (--vb.state.count);
+        } while (--count);
     }
 
+    /* unset posibble set count */
+    vb.state.count = 0;
     vb_set_mode(VB_MODE_NORMAL | VB_MODE_SEARCH, false);
 
     return true;
-- 
2.20.1