diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-11-20 19:12:39 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-11-20 19:12:39 +0000 |
commit | 58688c48aa78173406c4037a6e8c0591ca3af591 (patch) | |
tree | e7b5781eef571caa96866ea67069eb929f348c6e /cmd-split-window.c | |
parent | 5d56225d95490fac96bc9ba00c6ce320ca2d8624 (diff) | |
download | rtmux-58688c48aa78173406c4037a6e8c0591ca3af591.tar.gz rtmux-58688c48aa78173406c4037a6e8c0591ca3af591.tar.bz2 rtmux-58688c48aa78173406c4037a6e8c0591ca3af591.zip |
When -h and -p are given to split-window, calculate the percentage size using
the width instead of the height.
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r-- | cmd-split-window.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c index 4dd03055..ebe0ffef 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -174,17 +174,21 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) else cwd = ctx->cmdclient->cwd; + type = LAYOUT_TOPBOTTOM; + if (data->flag_horizontal) + type = LAYOUT_LEFTRIGHT; + size = -1; if (data->size != -1) size = data->size; - else if (data->percentage != -1) - size = (w->active->sy * data->percentage) / 100; + else if (data->percentage != -1) { + if (type == LAYOUT_TOPBOTTOM) + size = (w->active->sy * data->percentage) / 100; + else + size = (w->active->sx * data->percentage) / 100; + } hlimit = options_get_number(&s->options, "history-limit"); - type = LAYOUT_TOPBOTTOM; - if (data->flag_horizontal) - type = LAYOUT_LEFTRIGHT; - shell = options_get_string(&s->options, "default-shell"); if (*shell == '\0' || areshell(shell)) shell = _PATH_BSHELL; |