summaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-04-20 14:51:50 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2021-04-20 14:51:50 -0400
commita57a9682e74ff3609acb2ca6697fc6fa94c23fb6 (patch)
treebbe848dd7e5c7ae259fbcfdf3253240bc564c8d8 /ui.c
parentf90d98c3c451aa5be2979ff05863b5aa8bee9336 (diff)
:set-language, various other little things
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ui.c b/ui.c
index 0b6a0a0..993a51f 100644
--- a/ui.c
+++ b/ui.c
@@ -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) {