diff options
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; |