From 0c9851106bfac4693920fa81633740dc85ae743a Mon Sep 17 00:00:00 2001 From: James Booth Date: Wed, 9 Jul 2014 20:15:20 +0100 Subject: [PATCH] Added quote param to autocomplete searches --- src/tools/autocomplete.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c index 7aaf2ab5..668d78af 100644 --- a/src/tools/autocomplete.c +++ b/src/tools/autocomplete.c @@ -34,7 +34,7 @@ struct autocomplete_t { gchar *search_str; }; -static gchar * _search_from(Autocomplete ac, GSList *curr); +static gchar * _search_from(Autocomplete ac, GSList *curr, gboolean quote); Autocomplete autocomplete_new(void) @@ -166,18 +166,18 @@ autocomplete_complete(Autocomplete ac, gchar *search_str) FREE_SET_NULL(ac->search_str); } ac->search_str = strdup(search_str); - found = _search_from(ac, ac->items); + found = _search_from(ac, ac->items, TRUE); return found; // subsequent search attempt } else { // search from here+1 tp end - found = _search_from(ac, g_slist_next(ac->last_found)); + found = _search_from(ac, g_slist_next(ac->last_found), TRUE); if (found != NULL) return found; // search from beginning - found = _search_from(ac, ac->items); + found = _search_from(ac, ac->items, TRUE); if (found != NULL) return found; @@ -292,7 +292,7 @@ autocomplete_param_no_with_func(char *input, int *size, char *command, } static gchar * -_search_from(Autocomplete ac, GSList *curr) +_search_from(Autocomplete ac, GSList *curr, gboolean quote) { while(curr) { @@ -303,7 +303,7 @@ _search_from(Autocomplete ac, GSList *curr) ac->last_found = curr; // if contains space, quote before returning - if (g_strrstr(curr->data, " ")) { + if (quote && g_strrstr(curr->data, " ")) { GString *quoted = g_string_new("\""); g_string_append(quoted, curr->data); g_string_append(quoted, "\""); @@ -323,4 +323,4 @@ _search_from(Autocomplete ac, GSList *curr) } return NULL; -} +} \ No newline at end of file