Merge branch 'obsd-master'

pull/1275/head
Thomas Adam 2018-02-28 10:02:29 +00:00
commit 0ca9664ecf
9 changed files with 40 additions and 13 deletions

View File

@ -30,7 +30,7 @@ const struct cmd_entry cmd_choose_tree_entry = {
.name = "choose-tree", .name = "choose-tree",
.alias = NULL, .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] " .usage = "[-GNsw] [-F format] [-f filter] [-O sort-order] "
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,
@ -44,7 +44,7 @@ const struct cmd_entry cmd_choose_client_entry = {
.name = "choose-client", .name = "choose-client",
.alias = NULL, .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] " .usage = "[-N] [-F format] [-f filter] [-O sort-order] "
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,
@ -58,7 +58,7 @@ const struct cmd_entry cmd_choose_buffer_entry = {
.name = "choose-buffer", .name = "choose-buffer",
.alias = NULL, .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] " .usage = "[-N] [-F format] [-f filter] [-O sort-order] "
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,

View File

@ -183,9 +183,9 @@ key_bindings_init(void)
"bind 9 select-window -t:=9", "bind 9 select-window -t:=9",
"bind : command-prompt", "bind : command-prompt",
"bind \\; last-pane", "bind \\; last-pane",
"bind = choose-buffer", "bind = choose-buffer -Z",
"bind ? list-keys", "bind ? list-keys",
"bind D choose-client", "bind D choose-client -Z",
"bind E select-layout -E", "bind E select-layout -E",
"bind L switch-client -l", "bind L switch-client -l",
"bind M select-pane -M", "bind M select-pane -M",
@ -202,9 +202,9 @@ key_bindings_init(void)
"bind p previous-window", "bind p previous-window",
"bind q display-panes", "bind q display-panes",
"bind r refresh-client", "bind r refresh-client",
"bind s choose-tree -s", "bind s choose-tree -Zs",
"bind t clock-mode", "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 x confirm-before -p\"kill-pane #P? (y/n)\" kill-pane",
"bind z resize-pane -Z", "bind z resize-pane -Z",
"bind { swap-pane -U", "bind { swap-pane -U",

View File

@ -31,6 +31,7 @@ TAILQ_HEAD(mode_tree_list, mode_tree_item);
struct mode_tree_data { struct mode_tree_data {
int dead; int dead;
u_int references; u_int references;
int zoomed;
struct window_pane *wp; struct window_pane *wp;
void *modedata; void *modedata;
@ -343,6 +344,19 @@ mode_tree_start(struct window_pane *wp, struct args *args,
return (mtd); 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 void
mode_tree_build(struct mode_tree_data *mtd) mode_tree_build(struct mode_tree_data *mtd)
{ {
@ -394,6 +408,11 @@ mode_tree_remove_ref(struct mode_tree_data *mtd)
void void
mode_tree_free(struct mode_tree_data *mtd) 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_free_items(&mtd->children);
mode_tree_clear_lines(mtd); mode_tree_clear_lines(mtd);
screen_free(&mtd->screen); screen_free(&mtd->screen);

View File

@ -456,8 +456,6 @@ server_set_stdin_callback(struct client *c, void (*cb)(struct client *, int,
void void
server_unzoom_window(struct window *w) server_unzoom_window(struct window *w)
{ {
if (window_unzoom(w) == 0) { if (window_unzoom(w) == 0)
server_redraw_window(w); server_redraw_window(w);
server_status_window(w);
}
} }

12
tmux.1
View File

@ -1381,7 +1381,7 @@ the end of the visible pane.
The default is to capture only the visible contents of the pane. The default is to capture only the visible contents of the pane.
.It Xo .It Xo
.Ic choose-client .Ic choose-client
.Op Fl N .Op Fl NZ
.Op Fl F Ar format .Op Fl F Ar format
.Op Fl f Ar filter .Op Fl f Ar filter
.Op Fl O Ar sort-order .Op Fl O Ar sort-order
@ -1390,6 +1390,8 @@ The default is to capture only the visible contents of the pane.
.Xc .Xc
Put a pane into client mode, allowing a client to be selected interactively from Put a pane into client mode, allowing a client to be selected interactively from
a list. a list.
.Fl Z
zooms the pane.
The following keys may be used in client mode: The following keys may be used in client mode:
.Bl -column "Key" "Function" -offset indent .Bl -column "Key" "Function" -offset indent
.It Sy "Key" Ta Sy "Function" .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. This command works only if at least one client is attached.
.It Xo .It Xo
.Ic choose-tree .Ic choose-tree
.Op Fl GNsw .Op Fl GNswZ
.Op Fl F Ar format .Op Fl F Ar format
.Op Fl f Ar filter .Op Fl f Ar filter
.Op Fl O Ar sort-order .Op Fl O Ar sort-order
@ -1453,6 +1455,8 @@ interactively from a list.
starts with sessions collapsed and starts with sessions collapsed and
.Fl w .Fl w
with windows collapsed. with windows collapsed.
.Fl Z
zooms the pane.
The following keys may be used in tree mode: The following keys may be used in tree mode:
.Bl -column "Key" "Function" -offset indent .Bl -column "Key" "Function" -offset indent
.It Sy "Key" Ta Sy "Function" .It Sy "Key" Ta Sy "Function"
@ -4135,7 +4139,7 @@ The buffer commands are as follows:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Xo .It Xo
.Ic choose-buffer .Ic choose-buffer
.Op Fl N .Op Fl NZ
.Op Fl F Ar format .Op Fl F Ar format
.Op Fl f Ar filter .Op Fl f Ar filter
.Op Fl O Ar sort-order .Op Fl O Ar sort-order
@ -4144,6 +4148,8 @@ The buffer commands are as follows:
.Xc .Xc
Put a pane into buffer mode, where a buffer may be chosen interactively from Put a pane into buffer mode, where a buffer may be chosen interactively from
a list. a list.
.Fl Z
zooms the pane.
The following keys may be used in buffer mode: The following keys may be used in buffer mode:
.Bl -column "Key" "Function" -offset indent .Bl -column "Key" "Function" -offset indent
.It Sy "Key" Ta Sy "Function" .It Sy "Key" Ta Sy "Function"

1
tmux.h
View File

@ -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 *, struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *,
mode_tree_build_cb, mode_tree_draw_cb, mode_tree_search_cb, mode_tree_build_cb, mode_tree_draw_cb, mode_tree_search_cb,
void *, const char **, u_int, struct screen **); 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_build(struct mode_tree_data *);
void mode_tree_free(struct mode_tree_data *); void mode_tree_free(struct mode_tree_data *);
void mode_tree_resize(struct mode_tree_data *, u_int, u_int); void mode_tree_resize(struct mode_tree_data *, u_int, u_int);

View File

@ -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, data->data = mode_tree_start(wp, args, window_buffer_build,
window_buffer_draw, window_buffer_search, data, window_buffer_draw, window_buffer_search, data,
window_buffer_sort_list, nitems(window_buffer_sort_list), &s); window_buffer_sort_list, nitems(window_buffer_sort_list), &s);
mode_tree_zoom(data->data, args);
mode_tree_build(data->data); mode_tree_build(data->data);
mode_tree_draw(data->data); mode_tree_draw(data->data);

View File

@ -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, data->data = mode_tree_start(wp, args, window_client_build,
window_client_draw, NULL, data, window_client_sort_list, window_client_draw, NULL, data, window_client_sort_list,
nitems(window_client_sort_list), &s); nitems(window_client_sort_list), &s);
mode_tree_zoom(data->data, args);
mode_tree_build(data->data); mode_tree_build(data->data);
mode_tree_draw(data->data); mode_tree_draw(data->data);

View File

@ -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, data->data = mode_tree_start(wp, args, window_tree_build,
window_tree_draw, window_tree_search, data, window_tree_sort_list, window_tree_draw, window_tree_search, data, window_tree_sort_list,
nitems(window_tree_sort_list), &s); nitems(window_tree_sort_list), &s);
mode_tree_zoom(data->data, args);
mode_tree_build(data->data); mode_tree_build(data->data);
mode_tree_draw(data->data); mode_tree_draw(data->data);