diff options
author | nicm <nicm> | 2017-06-09 15:29:15 +0000 |
---|---|---|
committer | nicm <nicm> | 2017-06-09 15:29:15 +0000 |
commit | bab4da51334499d1e3e43ad155f2f8da6ad0eb76 (patch) | |
tree | 83d04410966d3d4cecb6fe92680faec723245087 /mode-tree.c | |
parent | 3ec28ceb9bc4f4f3c186d8006b3ab0c776714fa5 (diff) | |
download | rtmux-bab4da51334499d1e3e43ad155f2f8da6ad0eb76.tar.gz rtmux-bab4da51334499d1e3e43ad155f2f8da6ad0eb76.tar.bz2 rtmux-bab4da51334499d1e3e43ad155f2f8da6ad0eb76.zip |
Add -O option to choose-* to set initial sort order.
Diffstat (limited to 'mode-tree.c')
-rw-r--r-- | mode-tree.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mode-tree.c b/mode-tree.c index 1093aff3..aaea9160 100644 --- a/mode-tree.c +++ b/mode-tree.c @@ -273,12 +273,15 @@ mode_tree_each_tagged(struct mode_tree_data *mtd, void (*cb)(void *, void *, } struct mode_tree_data * -mode_tree_start(struct window_pane *wp, void (*buildcb)(void *, u_int, - uint64_t *), struct screen *(*drawcb)(void *, void *, u_int, u_int), +mode_tree_start(struct window_pane *wp, struct args *args, + void (*buildcb)(void *, u_int, uint64_t *), + struct screen *(*drawcb)(void *, void *, u_int, u_int), int (*searchcb)(void *, void *, const char *), void *modedata, const char **sort_list, u_int sort_size, struct screen **s) { struct mode_tree_data *mtd; + const char *sort; + u_int i; mtd = xcalloc(1, sizeof *mtd); mtd->references = 1; @@ -290,6 +293,14 @@ mode_tree_start(struct window_pane *wp, void (*buildcb)(void *, u_int, mtd->sort_size = sort_size; mtd->sort_type = 0; + sort = args_get(args, 'O'); + if (sort != NULL) { + for (i = 0; i < sort_size; i++) { + if (strcasecmp(sort, sort_list[i]) == 0) + mtd->sort_type = i; + } + } + mtd->buildcb = buildcb; mtd->drawcb = drawcb; mtd->searchcb = searchcb; |