From: Daniel Carl Date: Tue, 16 Jul 2013 20:53:53 +0000 (+0200) Subject: Reapplied sorting of completion entries. X-Git-Url: https://git.owens.tech/assets/static/gitweb.css/assets/static/gitweb.css/git?a=commitdiff_plain;h=01dccdc462cc84bed8fe51f183185bebb2c0c544;p=vimb.git Reapplied sorting of completion entries. --- diff --git a/src/completion.c b/src/completion.c index af58b8c..eb79209 100644 --- a/src/completion.c +++ b/src/completion.c @@ -44,12 +44,13 @@ static void move_cursor(gboolean back); static gboolean tree_selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean selected, gpointer data); + gboolean completion_complete(gboolean back) { VbInputType type; const char *input, *prefix, *suffix; GtkListStore *store = NULL; - gboolean res = false; + gboolean res = false, sort = true; input = GET_TEXT(); type = vb_get_input_parts(input, &prefix, &suffix); @@ -80,8 +81,9 @@ gboolean completion_complete(gboolean back) if (suffix && *suffix == TAG_INDICATOR) { res = bookmark_fill_completion(store, suffix + 1); } else { - res = history_fill_completion(store, HISTORY_URL, suffix); + res = history_fill_completion(store, HISTORY_URL, suffix); } + sort = false; } else if (type == VB_INPUT_COMMAND) { char *command = NULL; /* remove counts before command and save it to print it later in inputbox */ @@ -96,6 +98,11 @@ gboolean completion_complete(gboolean back) return false; } + /* apply the defualt sorting to the first tree model comlumn */ + if (sort) { + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), COMPLETION_STORE_FIRST, GTK_SORT_ASCENDING); + } + vb_set_mode(VB_MODE_COMMAND | VB_MODE_COMPLETE, false); OVERWRITE_STRING(comp.prefix, prefix); diff --git a/src/history.c b/src/history.c index b05241c..d09d2a9 100644 --- a/src/history.c +++ b/src/history.c @@ -132,6 +132,7 @@ gboolean history_fill_completion(GtkListStore *store, HistoryType type, const ch History *item; src = load(get_file_by_type(type)); + src = g_list_reverse(src); if (!input || *input == '\0') { /* without any tags return all items */ for (GList *l = src; l; l = l->next) {