summaryrefslogtreecommitdiffstats
path: root/cmd-resize-pane.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-22 10:37:39 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-22 10:37:39 +0000
commitf0efa576e002e77dc6363e0a5bc41d0c0649c946 (patch)
tree19a401bcc41eb34271b9bdf85f608c4172bf8e20 /cmd-resize-pane.c
parentad5df9bc2f00b3de89e1c2bd6714022cf99aacda (diff)
Add resize-pane -x and -y for absolute pane size (much requested).
Diffstat (limited to 'cmd-resize-pane.c')
-rw-r--r--cmd-resize-pane.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index c200ee10..dbcebbcf 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_ctx *);
const struct cmd_entry cmd_resize_pane_entry = {
"resize-pane", "resizep",
- "DLRt:U", 0, 1,
- "[-DLRU] " CMD_TARGET_PANE_USAGE " [adjustment]",
+ "DLRt:Ux:y:", 0, 1,
+ "[-DLRU] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]",
0,
cmd_resize_pane_key_binding,
NULL,
@@ -87,8 +87,10 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
struct args *args = self->args;
struct winlink *wl;
const char *errstr;
+ char *cause;
struct window_pane *wp;
u_int adjust;
+ int x, y;
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp)) == NULL)
return (CMD_RETURN_ERROR);
@@ -103,6 +105,27 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
}
}
+ if (args_has(self->args, 'x')) {
+ x = args_strtonum(self->args, 'x', PANE_MINIMUM, INT_MAX,
+ &cause);
+ if (cause != NULL) {
+ ctx->error(ctx, "width %s", cause);
+ free(cause);
+ return (CMD_RETURN_ERROR);
+ }
+ layout_resize_pane_to(wp, LAYOUT_LEFTRIGHT, x);
+ }
+ if (args_has(self->args, 'y')) {
+ y = args_strtonum(self->args, 'y', PANE_MINIMUM, INT_MAX,
+ &cause);
+ if (cause != NULL) {
+ ctx->error(ctx, "height %s", cause);
+ free(cause);
+ return (CMD_RETURN_ERROR);
+ }
+ layout_resize_pane_to(wp, LAYOUT_TOPBOTTOM, y);
+ }
+
if (args_has(self->args, 'L'))
layout_resize_pane(wp, LAYOUT_LEFTRIGHT, -adjust);
else if (args_has(self->args, 'R'))