diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2013-03-24 09:57:59 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2013-03-24 09:57:59 +0000 |
commit | c71844de631186f3df7ff5a6e3aab613da1e4853 (patch) | |
tree | 11225419cb1fd07855bcf628df487a25248103fc /cmd-resize-pane.c | |
parent | a05b8c41437409f83cb1df2adc0998791d7a2038 (diff) | |
download | rtmux-c71844de631186f3df7ff5a6e3aab613da1e4853.tar.gz rtmux-c71844de631186f3df7ff5a6e3aab613da1e4853.tar.bz2 rtmux-c71844de631186f3df7ff5a6e3aab613da1e4853.zip |
Add resize-pane -Z to temporary zoom the active pane to occupy the full
window or unzoom (restored to the normal layout) if it already zoomed,
bound to C-b z by default. The pane is unzoomed on pretty much any
excuse whatsoever.
We considered making this a new layout but the requirements are quite
different from layouts so decided it is better as a special case. Each
current layout cell is saved, a temporary one-cell layout generated and
all except the active pane set to NULL.
Prompted by suggestions and scripts from several. Thanks to Aaron Jensen
and Thiago Padilha for testing an earlier version.
Diffstat (limited to 'cmd-resize-pane.c')
-rw-r--r-- | cmd-resize-pane.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index f31e3258..41c15269 100644 --- a/cmd-resize-pane.c +++ b/cmd-resize-pane.c @@ -31,8 +31,8 @@ enum cmd_retval cmd_resize_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_resize_pane_entry = { "resize-pane", "resizep", - "DLRt:Ux:y:", 0, 1, - "[-DLRU] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]", + "DLRt:Ux:y:Z", 0, 1, + "[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]", 0, cmd_resize_pane_key_binding, NULL, @@ -75,6 +75,10 @@ cmd_resize_pane_key_binding(struct cmd *self, int key) self->args = args_create(1, "5"); args_set(self->args, 'R', NULL); break; + case 'z': + self->args = args_create(0); + args_set(self->args, 'Z', NULL); + break; default: self->args = args_create(0); break; @@ -86,6 +90,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; struct winlink *wl; + struct window *w; const char *errstr; char *cause; struct window_pane *wp; @@ -94,6 +99,18 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) if ((wl = cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp)) == NULL) return (CMD_RETURN_ERROR); + w = wl->window; + + if (args_has(args, 'Z')) { + if (w->flags & WINDOW_ZOOMED) + window_unzoom(w); + else + window_zoom(wp); + server_redraw_window(w); + server_status_window(w); + return (CMD_RETURN_NORMAL); + } + server_unzoom_window(w); if (args->argc == 0) adjust = 1; |