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;
forward = !(arg->i ^ dir);
if (query) {
- int count;
#ifdef FEATURE_SEARCH_HIGHLIGHT
if (!highlight) {
/* highlight matches if the search is started new or continued
}
#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;
} while (--count);
}
- /* unset posibble set count */
- vb.state.count = 0;
-
return true;
}
};
#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);
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 ';':
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);
/* state */
typedef struct {
- char modkey;
- guint count;
guint progress;
StatusType status_type;
MessageType input_type;
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);
}
/**
{
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;
}
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;
}
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;