mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Sort the completion results
Make sure the current option is shown first.
This commit is contained in:
parent
31f12c10df
commit
7307b48bd6
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user