1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

Sort the completion results

Make sure the current option is shown first.
This commit is contained in:
LemonBoy 2016-06-12 22:58:35 +02:00
parent 31f12c10df
commit 7307b48bd6

View File

@ -690,19 +690,20 @@ static void sig_complete_set(GList **list, WINDOW_REC *window,
else if (*line != '\0' && *word == '\0') {
SETTINGS_REC *rec = settings_get_record(line);
if (rec != NULL) {
char *value = settings_get_print(rec);
/* show the current option first */
if (value != NULL)
*list = g_list_append(*list, value);
/* show the whole list of valid options */
if (rec->type == SETTING_TYPE_CHOICE) {
char **tmp = rec->choices;
char **tmp;
while (*tmp)
*list = g_list_append(*list, g_strdup(*tmp++));
}
/* show the current option */
else {
char *value = settings_get_print(rec);
if (value != NULL)
*list = g_list_append(*list, value);
for (tmp = rec->choices; *tmp; tmp++) {
if (g_ascii_strcasecmp(*tmp, value) != 0)
*list = g_list_append(*list, g_strdup(*tmp));
}
}
}
}