aboutsummaryrefslogtreecommitdiff
path: root/cmd-resize-pane.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2013-02-24 00:25:03 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2013-02-24 00:25:03 +0000
commitc5239c59846c2d09725d4b1db0e728b3376c3998 (patch)
tree1fedf6dcd02ec5c6b18ee45146dc21957d4b8c4e /cmd-resize-pane.c
parentbe13479f099749b2a199e17505797e51090caca0 (diff)
downloadrtmux-c5239c59846c2d09725d4b1db0e728b3376c3998.tar.gz
rtmux-c5239c59846c2d09725d4b1db0e728b3376c3998.tar.bz2
rtmux-c5239c59846c2d09725d4b1db0e728b3376c3998.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.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index a97b8cd6..ca2a6cd3 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;