diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-18 17:00:35 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-18 17:00:35 +0000 |
commit | e4bb87032eb851338aa77bceb3e4581da3281a1d (patch) | |
tree | 2f3d1e4231f7e644615113753f1aec7f286d992b /cmd-resize-pane.c | |
parent | a6c4c2cca0d44e0cec9d4a0cc041290a263826fb (diff) | |
download | rtmux-e4bb87032eb851338aa77bceb3e4581da3281a1d.tar.gz rtmux-e4bb87032eb851338aa77bceb3e4581da3281a1d.tar.bz2 rtmux-e4bb87032eb851338aa77bceb3e4581da3281a1d.zip |
Add resize-pane -x and -y for absolute pane size.
Diffstat (limited to 'cmd-resize-pane.c')
-rw-r--r-- | cmd-resize-pane.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index 74f6354c..328e1b4d 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')) |