1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Quote autocompleted strings when contain a space

This commit is contained in:
James Booth 2013-01-14 22:16:12 +00:00
parent 87c3107847
commit f5711001f7

View File

@ -200,9 +200,22 @@ _search_from(PAutocomplete ac, GSList *curr)
// set pointer to last found // set pointer to last found
ac->last_found = curr; ac->last_found = curr;
// return the string, must be free'd by caller // if contains space, quote before returning
if (g_strrstr(curr->data, " ")) {
GString *quoted = g_string_new("\"");
g_string_append(quoted, curr->data);
g_string_append(quoted, "\"");
gchar *result = quoted->str;
g_string_free(quoted, FALSE);
return result;
// otherwise just return the string
} else {
return strdup(curr->data); return strdup(curr->data);
} }
}
curr = g_slist_next(curr); curr = g_slist_next(curr);
} }