[Users] [PATCH] quicksearch: expand extended symbols on "Edit"

Olivier Brunel jjk at jjacky.com
Sat Jun 10 23:09:02 CEST 2017


Instead of silently ignoring the current string when it used extended
symbols, expand it into condition expressions to allow editing it.
---
This could be a matter of personal preferences I guess, but as I added a similar
feature/button to vfolder, I did it that way because from a user POV I find it
more useful to have the extended symbols expanded & editable, rather than an
empty list of conditions.

Besides, it much easier/quicker to hit "Clear" first it one wants an empty list,
than having to re-set manually whatever the expression of extended symbols might
have been.

So, here's a suggestion to do the same in quicksearch.

 src/gtk/quicksearch.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gtk/quicksearch.c b/src/gtk/quicksearch.c
index 52829cb2d..c7531d545 100644
--- a/src/gtk/quicksearch.c
+++ b/src/gtk/quicksearch.c
@@ -590,12 +590,16 @@ static gboolean search_condition_expr(GtkMenuItem *widget, gpointer data)
 			mainwindow_get_mainwindow()->summaryview->quicksearch != NULL,
 			FALSE);
 
-	/* re-use the current quicksearch value if it's a condition expression,
-	   otherwise ignore it silently */
+	/* re-use the current quicksearch value, expanding it so it also works
+	 * with extended symbols */
 	cond_str = quicksearch_get_text(mainwindow_get_mainwindow()->summaryview->quicksearch);
 
 	if (*cond_str != '\0') {
-		matchers = matcher_parser_get_cond((gchar*)cond_str, NULL);
+		gchar *newstr = advsearch_expand_search_string(cond_str);
+
+		if (newstr && newstr[0] != '\0' && strchr(newstr, ' '))
+			matchers = matcher_parser_get_cond(newstr, FALSE);
+		g_free(newstr);
 	}
 
 	prefs_matcher_open(matchers, search_condition_expr_done);
-- 
2.13.1




More information about the Users mailing list