mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Add -O option to choose-* to set initial sort order.
This commit is contained in:
15
mode-tree.c
15
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;
|
||||
|
Reference in New Issue
Block a user