From: Daniel Carl Date: Wed, 31 Aug 2016 21:15:33 +0000 (+0200) Subject: Show search match count also if highlight is off. X-Git-Url: https://git.owens.tech/rss.xml/rss.xml/git?a=commitdiff_plain;h=b2a21253df329676f477cb2aac21748a8ac8c9e0;p=vimb.git Show search match count also if highlight is off. --- diff --git a/src/command.c b/src/command.c index 9af68f4..2ba4c62 100644 --- a/src/command.c +++ b/src/command.c @@ -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) { diff --git a/src/main.c b/src/main.c index 3218d71..09ed4d9 100644 --- a/src/main.c +++ b/src/main.c @@ -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) { diff --git a/src/main.h b/src/main.h index f1fbd40..0ba07c5 100644 --- a/src/main.h +++ b/src/main.h @@ -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 */