Removed nor more used count.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 27 Sep 2013 22:14:22 +0000 (00:14 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 27 Sep 2013 22:14:22 +0000 (00:14 +0200)
src/command.c
src/command.h
src/ex.c
src/main.c
src/main.h
src/normal.c

index 04bb7ae..3aabcfa 100644 (file)
@@ -29,7 +29,7 @@
 
 extern VbCore vb;
 
-gboolean command_search(const Arg *arg)
+gboolean command_search(const Arg *arg, unsigned int count)
 {
     static SearchDirection dir;
     static char *query = NULL;
@@ -56,7 +56,6 @@ 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
@@ -70,8 +69,6 @@ gboolean command_search(const Arg *arg)
         }
 #endif
 
-        /* make sure we have a count greater than 0 */
-        count = vb.state.count ? vb.state.count : 1;
         do {
             if (!webkit_web_view_search_text(vb.gui.webview, query, false, forward, true)) {
                 break;
@@ -79,9 +76,6 @@ gboolean command_search(const Arg *arg)
         } while (--count);
     }
 
-    /* unset posibble set count */
-    vb.state.count = 0;
-
     return true;
 }
 
index b6de228..42426a8 100644 (file)
@@ -46,7 +46,7 @@ enum {
 };
 #endif
 
-gboolean command_search(const Arg *arg);
+gboolean command_search(const Arg *arg, unsigned int count);
 gboolean command_history(const Arg *arg);
 gboolean command_yank(const Arg *arg);
 gboolean command_save(const Arg *arg);
index afc17cc..ecc74a1 100644 (file)
--- a/src/ex.c
+++ b/src/ex.c
@@ -357,7 +357,7 @@ static void input_activate(void)
         case '?':
             history_add(HISTORY_SEARCH, cmd, NULL);
             mode_enter('n');
-            command_search(&((Arg){forward ? COMMAND_SEARCH_FORWARD : COMMAND_SEARCH_BACKWARD, cmd}));
+            command_search(&((Arg){forward ? COMMAND_SEARCH_FORWARD : COMMAND_SEARCH_BACKWARD, cmd}), 1);
             break;
 
         case ';':
index ec7cbc4..1be841c 100644 (file)
@@ -257,13 +257,6 @@ void vb_update_statusbar()
     int max, val, num;
     GString *status = g_string_new("");
 
-    /* show current count */
-    g_string_append_printf(status, "%.0d", vb.state.count);
-    /* show current modkey */
-    if (vb.state.modkey) {
-        g_string_append_c(status, vb.state.modkey);
-    }
-
     /* show the active downloads */
     if (vb.state.downloads) {
         num = g_list_length(vb.state.downloads);
index 7e12767..183d5d4 100644 (file)
@@ -266,8 +266,6 @@ typedef struct {
 
 /* state */
 typedef struct {
-    char            modkey;
-    guint           count;
     guint           progress;
     StatusType      status_type;
     MessageType     input_type;
index 104f75f..12f5599 100644 (file)
@@ -218,7 +218,7 @@ void normal_enter(void)
 void normal_leave(void)
 {
     /* TODO clean those only if they where active */
-    command_search(&((Arg){COMMAND_SEARCH_OFF}));
+    command_search(&((Arg){COMMAND_SEARCH_OFF}), 0);
 }
 
 /**
@@ -272,11 +272,7 @@ static VbResult normal_clear_input(const NormalCmdInfo *info)
 {
     vb_set_input_text("");
     gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview));
-    /* TODO implement the search new - so we can remove the command.c file */
-    command_search(&((Arg){COMMAND_SEARCH_OFF}));
-    /* check flags on the current state to only clear hints if they where
-     * enabled before */
-    /*hints_clear();*/
+    command_search(&((Arg){COMMAND_SEARCH_OFF}), 0);
 
     return RESULT_COMPLETE;
 }
@@ -585,7 +581,10 @@ static VbResult normal_scroll(const NormalCmdInfo *info)
 
 static VbResult normal_search(const NormalCmdInfo *info)
 {
-    command_search(&((Arg){info->cmd == 'n' ? COMMAND_SEARCH_FORWARD : COMMAND_SEARCH_BACKWARD}));
+    command_search(
+        &((Arg){info->cmd == 'n' ? COMMAND_SEARCH_FORWARD : COMMAND_SEARCH_BACKWARD}),
+        info->count > 0 ? info->count : 1
+    );
     return RESULT_COMPLETE;
 }
 
@@ -599,7 +598,10 @@ static VbResult normal_search_selection(const NormalCmdInfo *info)
         return RESULT_ERROR;
     }
 
-    command_search(&((Arg){info->cmd == '*' ? COMMAND_SEARCH_FORWARD : COMMAND_SEARCH_BACKWARD, query}));
+    command_search(
+        &((Arg){info->cmd == '*' ? COMMAND_SEARCH_FORWARD : COMMAND_SEARCH_BACKWARD, query}),
+        info->count > 0 ? info->count : 1
+    );
     g_free(query);
 
     return RESULT_COMPLETE;