diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c index 815c2a03..23914178 100644 --- a/cmd-choose-tree.c +++ b/cmd-choose-tree.c @@ -30,7 +30,7 @@ const struct cmd_entry cmd_choose_tree_entry = { .name = "choose-tree", .alias = NULL, - .args = { "F:Gf:NO:st:w", 0, 1 }, + .args = { "F:Gf:NO:st:wZ", 0, 1 }, .usage = "[-GNsw] [-F format] [-f filter] [-O sort-order] " CMD_TARGET_PANE_USAGE, @@ -44,7 +44,7 @@ const struct cmd_entry cmd_choose_client_entry = { .name = "choose-client", .alias = NULL, - .args = { "F:f:NO:t:", 0, 1 }, + .args = { "F:f:NO:t:Z", 0, 1 }, .usage = "[-N] [-F format] [-f filter] [-O sort-order] " CMD_TARGET_PANE_USAGE, @@ -58,7 +58,7 @@ const struct cmd_entry cmd_choose_buffer_entry = { .name = "choose-buffer", .alias = NULL, - .args = { "F:f:NO:t:", 0, 1 }, + .args = { "F:f:NO:t:Z", 0, 1 }, .usage = "[-N] [-F format] [-f filter] [-O sort-order] " CMD_TARGET_PANE_USAGE, diff --git a/key-bindings.c b/key-bindings.c index a13c7977..83670d2d 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -183,9 +183,9 @@ key_bindings_init(void) "bind 9 select-window -t:=9", "bind : command-prompt", "bind \\; last-pane", - "bind = choose-buffer", + "bind = choose-buffer -Z", "bind ? list-keys", - "bind D choose-client", + "bind D choose-client -Z", "bind E select-layout -E", "bind L switch-client -l", "bind M select-pane -M", @@ -202,9 +202,9 @@ key_bindings_init(void) "bind p previous-window", "bind q display-panes", "bind r refresh-client", - "bind s choose-tree -s", + "bind s choose-tree -Zs", "bind t clock-mode", - "bind w choose-tree -w", + "bind w choose-tree -Zw", "bind x confirm-before -p\"kill-pane #P? (y/n)\" kill-pane", "bind z resize-pane -Z", "bind { swap-pane -U", diff --git a/mode-tree.c b/mode-tree.c index cbef4f6a..05ec492d 100644 --- a/mode-tree.c +++ b/mode-tree.c @@ -31,6 +31,7 @@ TAILQ_HEAD(mode_tree_list, mode_tree_item); struct mode_tree_data { int dead; u_int references; + int zoomed; struct window_pane *wp; void *modedata; @@ -343,6 +344,19 @@ mode_tree_start(struct window_pane *wp, struct args *args, return (mtd); } +void +mode_tree_zoom(struct mode_tree_data *mtd, struct args *args) +{ + struct window_pane *wp = mtd->wp; + + if (args_has(args, 'Z')) { + mtd->zoomed = (wp->window->flags & WINDOW_ZOOMED); + if (!mtd->zoomed && window_zoom(wp) == 0) + server_redraw_window(wp->window); + } else + mtd->zoomed = -1; +} + void mode_tree_build(struct mode_tree_data *mtd) { @@ -394,6 +408,11 @@ mode_tree_remove_ref(struct mode_tree_data *mtd) void mode_tree_free(struct mode_tree_data *mtd) { + struct window_pane *wp = mtd->wp; + + if (mtd->zoomed == 0) + server_unzoom_window(wp->window); + mode_tree_free_items(&mtd->children); mode_tree_clear_lines(mtd); screen_free(&mtd->screen); diff --git a/server-fn.c b/server-fn.c index 008c96ee..383ac120 100644 --- a/server-fn.c +++ b/server-fn.c @@ -456,8 +456,6 @@ server_set_stdin_callback(struct client *c, void (*cb)(struct client *, int, void server_unzoom_window(struct window *w) { - if (window_unzoom(w) == 0) { + if (window_unzoom(w) == 0) server_redraw_window(w); - server_status_window(w); - } } diff --git a/tmux.1 b/tmux.1 index e17f7c45..bdb857d3 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1381,7 +1381,7 @@ the end of the visible pane. The default is to capture only the visible contents of the pane. .It Xo .Ic choose-client -.Op Fl N +.Op Fl NZ .Op Fl F Ar format .Op Fl f Ar filter .Op Fl O Ar sort-order @@ -1390,6 +1390,8 @@ The default is to capture only the visible contents of the pane. .Xc Put a pane into client mode, allowing a client to be selected interactively from a list. +.Fl Z +zooms the pane. The following keys may be used in client mode: .Bl -column "Key" "Function" -offset indent .It Sy "Key" Ta Sy "Function" @@ -1440,7 +1442,7 @@ starts without the preview. This command works only if at least one client is attached. .It Xo .Ic choose-tree -.Op Fl GNsw +.Op Fl GNswZ .Op Fl F Ar format .Op Fl f Ar filter .Op Fl O Ar sort-order @@ -1453,6 +1455,8 @@ interactively from a list. starts with sessions collapsed and .Fl w with windows collapsed. +.Fl Z +zooms the pane. The following keys may be used in tree mode: .Bl -column "Key" "Function" -offset indent .It Sy "Key" Ta Sy "Function" @@ -4135,7 +4139,7 @@ The buffer commands are as follows: .Bl -tag -width Ds .It Xo .Ic choose-buffer -.Op Fl N +.Op Fl NZ .Op Fl F Ar format .Op Fl f Ar filter .Op Fl O Ar sort-order @@ -4144,6 +4148,8 @@ The buffer commands are as follows: .Xc Put a pane into buffer mode, where a buffer may be chosen interactively from a list. +.Fl Z +zooms the pane. The following keys may be used in buffer mode: .Bl -column "Key" "Function" -offset indent .It Sy "Key" Ta Sy "Function" diff --git a/tmux.h b/tmux.h index d5d2122d..542b8d53 100644 --- a/tmux.h +++ b/tmux.h @@ -2251,6 +2251,7 @@ void mode_tree_down(struct mode_tree_data *, int); struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *, mode_tree_build_cb, mode_tree_draw_cb, mode_tree_search_cb, void *, const char **, u_int, struct screen **); +void mode_tree_zoom(struct mode_tree_data *, struct args *); void mode_tree_build(struct mode_tree_data *); void mode_tree_free(struct mode_tree_data *); void mode_tree_resize(struct mode_tree_data *, u_int, u_int); diff --git a/window-buffer.c b/window-buffer.c index 17c13fc3..a80c369d 100644 --- a/window-buffer.c +++ b/window-buffer.c @@ -272,6 +272,7 @@ window_buffer_init(struct window_pane *wp, __unused struct cmd_find_state *fs, 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); + mode_tree_zoom(data->data, args); mode_tree_build(data->data); mode_tree_draw(data->data); diff --git a/window-client.c b/window-client.c index aae9e0b4..69f99904 100644 --- a/window-client.c +++ b/window-client.c @@ -256,6 +256,7 @@ window_client_init(struct window_pane *wp, __unused struct cmd_find_state *fs, 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); + mode_tree_zoom(data->data, args); mode_tree_build(data->data); mode_tree_draw(data->data); diff --git a/window-tree.c b/window-tree.c index ef7cec8a..3c587cb9 100644 --- a/window-tree.c +++ b/window-tree.c @@ -841,6 +841,7 @@ window_tree_init(struct window_pane *wp, struct cmd_find_state *fs, 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_zoom(data->data, args); mode_tree_build(data->data); mode_tree_draw(data->data);