-/* $OpenBSD: cmd-choose-tree.c,v 1.35 2017/05/30 21:44:59 nicm Exp $ */
+/* $OpenBSD: cmd-choose-tree.c,v 1.36 2017/06/09 15:29:15 nicm Exp $ */
/*
* Copyright (c) 2012 Thomas Adam <thomas@xteddy.org>
.name = "choose-tree",
.alias = NULL,
- .args = { "st:w", 0, 1 },
- .usage = "[-sw] " CMD_TARGET_PANE_USAGE,
+ .args = { "O:st:w", 0, 1 },
+ .usage = "[-sw] [-O sort-order] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
.name = "choose-client",
.alias = NULL,
- .args = { "t:", 0, 1 },
- .usage = CMD_TARGET_PANE_USAGE,
+ .args = { "O:t:", 0, 1 },
+ .usage = "[-O sort-order] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
.name = "choose-buffer",
.alias = NULL,
- .args = { "t:", 0, 1 },
- .usage = CMD_TARGET_PANE_USAGE,
+ .args = { "O:t:", 0, 1 },
+ .usage = "[-O sort-order] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
-/* $OpenBSD: mode-tree.c,v 1.4 2017/06/07 15:27:46 nicm Exp $ */
+/* $OpenBSD: mode-tree.c,v 1.5 2017/06/09 15:29:15 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
}
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;
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;
-.\" $OpenBSD: tmux.1,v 1.560 2017/06/09 09:21:24 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.561 2017/06/09 15:29:15 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
The default is to capture only the visible contents of the pane.
.It Xo
.Ic choose-client
+.Op Fl O Ar sort-order
.Op Fl t Ar target-pane
.Op Ar template
.Xc
.Ar template
is not given, "detach-client -t '%%'" is used.
.Pp
+.Fl O
+specifies the initial sort order: one of
+.Ql name ,
+.Ql size ,
+.Ql creation ,
+or
+.Ql activity .
This command works only if at least one client is attached.
.It Xo
.Ic choose-tree
.Op Fl sw
+.Op Fl O Ar sort-order
.Op Fl t Ar target-pane
.Op Ar template
.Xc
.Ar template
is not given, "switch-client -t '%%'" is used.
.Pp
+.Fl O
+specifies the initial sort order: one of
+.Ql index ,
+.Ql name ,
+or
+.Ql time .
This command works only if at least one client is attached.
.It Xo
.Ic display-panes
.Bl -tag -width Ds
.It Xo
.Ic choose-buffer
+.Op Fl O Ar sort-order
.Op Fl t Ar target-pane
.Op Ar template
.Xc
.Ar template
is not given, "paste-buffer -b '%%'" is used.
.Pp
+.Fl O
+specifies the initial sort order: one of
+.Ql time ,
+.Ql name
+or
+.Ql size .
This command works only if at least one client is attached.
.It Ic clear-history Op Fl t Ar target-pane
.D1 (alias: Ic clearhist )
-/* $OpenBSD: tmux.h,v 1.783 2017/06/07 15:27:46 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.784 2017/06/09 15:29:15 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
key_code), key_code, int);
void mode_tree_up(struct mode_tree_data *, int);
void mode_tree_down(struct mode_tree_data *, int);
-struct mode_tree_data *mode_tree_start(struct window_pane *,
+struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *,
void (*)(void *, u_int, uint64_t *), struct screen *(*)(void *,
void *, u_int, u_int), int (*)(void *, void *, const char *),
void *, const char **, u_int, struct screen **);
-/* $OpenBSD: window-buffer.c,v 1.6 2017/06/09 15:17:20 nicm Exp $ */
+/* $OpenBSD: window-buffer.c,v 1.7 2017/06/09 15:29:15 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
else
data->command = xstrdup(args->argv[0]);
- data->data = mode_tree_start(wp, window_buffer_build,
+ data->data = mode_tree_start(wp, args, window_buffer_build,
window_buffer_draw, window_buffer_search, data,
window_buffer_sort_list, nitems(window_buffer_sort_list), &s);
-/* $OpenBSD: window-client.c,v 1.4 2017/06/08 07:48:04 nicm Exp $ */
+/* $OpenBSD: window-client.c,v 1.5 2017/06/09 15:29:15 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
static const char *window_client_sort_list[] = {
"name",
"size",
- "creation time",
- "activity time"
+ "creation",
+ "activity"
};
struct window_client_itemdata {
else
data->command = xstrdup(args->argv[0]);
- data->data = mode_tree_start(wp, window_client_build,
+ data->data = mode_tree_start(wp, args, window_client_build,
window_client_draw, NULL, data, window_client_sort_list,
nitems(window_client_sort_list), &s);
-/* $OpenBSD: window-tree.c,v 1.3 2017/06/07 14:37:30 nicm Exp $ */
+/* $OpenBSD: window-tree.c,v 1.4 2017/06/09 15:29:15 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
else
data->command = xstrdup(args->argv[0]);
- data->data = mode_tree_start(wp, window_tree_build, window_tree_draw,
- window_tree_search, data, window_tree_sort_list,
+ data->data = mode_tree_start(wp, args, window_tree_build,
+ window_tree_draw, window_tree_search, data, window_tree_sort_list,
nitems(window_tree_sort_list), &s);
mode_tree_build(data->data);