diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-04-22 22:17:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-04-22 22:17:30 +0000 |
commit | 86a57aee15eac741a4b804c86e9064c519c8d780 (patch) | |
tree | 6bcc0cc8128cda1b916381556a009d1e0d8c61e1 /usr.bin/tmux/window-choose.c | |
parent | 9aad500f837f6ecaa7f106247dfc128e883b60dc (diff) |
When using choose-tree -u, start with the current window
highlighted. From Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/window-choose.c')
-rw-r--r-- | usr.bin/tmux/window-choose.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/tmux/window-choose.c b/usr.bin/tmux/window-choose.c index 3f0b446bd73..820c7168ee3 100644 --- a/usr.bin/tmux/window-choose.c +++ b/usr.bin/tmux/window-choose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-choose.c,v 1.46 2013/03/25 10:11:45 nicm Exp $ */ +/* $OpenBSD: window-choose.c,v 1.47 2013/04/22 22:17:29 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -44,7 +44,6 @@ void window_choose_scroll_down(struct window_pane *); void window_choose_collapse(struct window_pane *, struct session *); void window_choose_expand(struct window_pane *, struct session *, u_int); -void window_choose_collapse_all(struct window_pane *); enum window_choose_input_type { WINDOW_CHOOSE_NORMAL = -1, @@ -102,8 +101,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd) } void -window_choose_ready(struct window_pane *wp, u_int cur, - void (*callbackfn)(struct window_choose_data *)) +window_choose_set_current(struct window_pane *wp, u_int cur) { struct window_choose_mode_data *data = wp->modedata; struct screen *s = &data->screen; @@ -112,12 +110,22 @@ window_choose_ready(struct window_pane *wp, u_int cur, if (data->selected > screen_size_y(s) - 1) data->top = ARRAY_LENGTH(&data->list) - screen_size_y(s); + window_choose_redraw_screen(wp); +} + +void +window_choose_ready(struct window_pane *wp, u_int cur, + void (*callbackfn)(struct window_choose_data *)) +{ + struct window_choose_mode_data *data = wp->modedata; + data->callbackfn = callbackfn; if (data->callbackfn == NULL) data->callbackfn = window_choose_default_callback; ARRAY_CONCAT(&data->old_list, &data->list); + window_choose_set_current(wp, cur); window_choose_collapse_all(wp); } |