rows = gtk_tree_model_iter_n_children(gtk_tree_view_get_model(tree), NULL);
if (back) {
- /* step back */
- if (--comp.active < 0) {
- if (comp.active == -1) {
- gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(comp.tree)));
- return false;
- } else {
- comp.active = rows - 1;
- }
+ comp.active--;
+ /* Step back over the beginning. */
+ if (comp.active == -1) {
+ /* Unselect the current item to show the user that the shown
+ * content is the initial typed content. */
+ gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(comp.tree)));
+
+ return false;
+ } else if (comp.active < -1) {
+ comp.active = rows - 1;
}
} else {
- /* step forward */
- if (++comp.active >= rows) {
- if (comp.active == rows) {
- gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(comp.tree)));
- return false;
- } else {
- comp.active = 0;
- }
+ comp.active++;
+ /* Step over the end. */
+ if (comp.active == rows) {
+ gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(comp.tree)));
+
+ return false;
+ } else if (comp.active >= rows) {
+ comp.active = 0;
}
}
char *input; /* input read from inputbox */
const char *in; /* pointer to input that we move */
gboolean found = false;
- gboolean sort = false;
+ gboolean sort = true;
GtkListStore *store;
/* if direction is 0 stop the completion */
} else {
found = history_fill_completion(store, HISTORY_URL, token);
}
+ sort = false;
break;
case EX_SET:
- sort = true;
found = setting_fill_completion(store, token);
break;
case EX_BMA:
- sort = true;
found = bookmark_fill_tag_completion(store, token);
break;
case EX_SCR:
- sort = true;
found = shortcut_fill_completion(store, token);
break;
case EX_HANDREM:
- sort = true;
found = handler_fill_completion(store, token);
break;
#ifdef FEATURE_AUTOCMD
case EX_AUTOCMD:
- sort = true;
found = autocmd_fill_event_completion(store, token);
break;
case EX_AUGROUP:
- sort = true;
found = autocmd_fill_group_completion(store, token);
break;
#endif
case EX_SAVE:
case EX_SOURCE:
- sort = true;
found = util_filename_fill_completion(store, token);
break;
if (ex_fill_completion(store, in)) {
OVERWRITE_STRING(excomp.prefix, ":");
found = true;
+ sort = false;
}
}
free_cmdarg(arg);
if (history_fill_completion(store, HISTORY_SEARCH, in + 1)) {
OVERWRITE_STRING(excomp.token, in + 1);
OVERWRITE_NSTRING(excomp.prefix, in, 1);
- sort = true;
found = true;
}
}