diff options
-rw-r--r-- | usr.bin/tmux/cmd-choose-tree.c | 7 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 | ||||
-rw-r--r-- | usr.bin/tmux/window-choose.c | 16 |
3 files changed, 20 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-choose-tree.c b/usr.bin/tmux/cmd-choose-tree.c index aa889a5cb4f..f3bfa8ed1e4 100644 --- a/usr.bin/tmux/cmd-choose-tree.c +++ b/usr.bin/tmux/cmd-choose-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-choose-tree.c,v 1.22 2013/04/22 16:34:53 nicm Exp $ */ +/* $OpenBSD: cmd-choose-tree.c,v 1.23 2013/04/22 22:17:29 nicm Exp $ */ /* * Copyright (c) 2012 Thomas Adam <thomas@xteddy.org> @@ -228,9 +228,12 @@ windows_only: free(final_win_template_last); window_choose_ready(wl->window->active, cur_win, NULL); + window_choose_collapse_all(wl->window->active); - if (args_has(args, 'u')) + if (args_has(args, 'u')) { window_choose_expand_all(wl->window->active); + window_choose_set_current(wl->window->active, cur_win); + } return (CMD_RETURN_NORMAL); } diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index d3c2d2ecc26..cea5e13300f 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.407 2013/03/27 11:17:12 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.408 2013/04/22 22:17:29 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -2257,6 +2257,8 @@ struct window_choose_data *window_choose_add_item(struct window_pane *, struct client *, struct winlink *, const char *, const char *, u_int); void window_choose_expand_all(struct window_pane *); +void window_choose_collapse_all(struct window_pane *); +void window_choose_set_current(struct window_pane *, u_int); /* names.c */ void queue_window_name(struct window *); 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); } |