From: Daniel Carl Date: Mon, 4 Mar 2013 13:16:30 +0000 (+0100) Subject: Sort url completions by their usage. X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=e48651afe1704266f7bc130384c642eda80642ed;p=vimb.git Sort url completions by their usage. --- diff --git a/src/completion.c b/src/completion.c index a2f5f5e..32cb8df 100644 --- a/src/completion.c +++ b/src/completion.c @@ -63,6 +63,7 @@ gboolean completion_complete(gboolean back) /* TODO move these decision to a more generic place */ if (!strncmp(input, ":set ", 5)) { source = g_hash_table_get_keys(core.settings); + source = g_list_sort(source, (GCompareFunc)g_strcmp0); vp.comps.completions = completion_init_completion( vp.comps.completions, source, (Comp_Func)g_str_has_prefix, ":set " ); @@ -78,6 +79,7 @@ gboolean completion_complete(gboolean back) ); } else { source = g_hash_table_get_keys(core.behave.commands); + source = g_list_sort(source, (GCompareFunc)g_strcmp0); vp.comps.completions = completion_init_completion( vp.comps.completions, source, (Comp_Func)g_str_has_prefix, ":" ); @@ -125,7 +127,6 @@ static GList* completion_init_completion(GList* target, GList* source, Comp_Func token = g_strsplit(command, " ", -1); - source = g_list_sort(source, (GCompareFunc)g_strcmp0); for (GList* l = source; l; l = l->next) { data = l->data; match = FALSE;