diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-04-20 14:51:50 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-04-20 14:51:50 -0400 |
commit | a57a9682e74ff3609acb2ca6697fc6fa94c23fb6 (patch) | |
tree | bbe848dd7e5c7ae259fbcfdf3253240bc564c8d8 /ui.c | |
parent | f90d98c3c451aa5be2979ff05863b5aa8bee9336 (diff) |
:set-language, various other little things
Diffstat (limited to 'ui.c')
-rw-r--r-- | ui.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -56,6 +56,16 @@ static void selector_down(Ted const *ted, Selector *s, i64 n) { selector_up(ted, s, -n); } +static int selectory_entry_cmp_name(void const *av, void const *bv) { + SelectorEntry const *a = av, *b = bv; + return strcmp(a->name, b->name); +} + +// sort entries alphabetically +static void selector_sort_entries_by_name(Selector *s) { + qsort(s->entries, s->n_entries, sizeof *s->entries, selectory_entry_cmp_name); +} + // returns a null-terminated UTF-8 string of the option selected, or NULL if none was. // you should call free() on the return value. static char *selector_update(Ted *ted, Selector *s) { |