summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-split-window.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2010-01-07 20:52:18 +0000
committernicm <nicm@openbsd.org>2010-01-07 20:52:18 +0000
commit572cd943d922f2baa649f3a45637ab4b573e26da (patch)
treed3f41d5c41923ed54f311d64f851d9c800dc2682 /usr.bin/tmux/cmd-split-window.c
parentRepair non-MULTIPROCESSOR kernel compilation. (diff)
downloadwireguard-openbsd-572cd943d922f2baa649f3a45637ab4b573e26da.tar.xz
wireguard-openbsd-572cd943d922f2baa649f3a45637ab4b573e26da.zip
New command, join-pane, to split and move an existing pane into the space (like
splitw then movep, or the reverse of breakp).
Diffstat (limited to 'usr.bin/tmux/cmd-split-window.c')
-rw-r--r--usr.bin/tmux/cmd-split-window.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c
index 9712a74d594..bcd3424582c 100644
--- a/usr.bin/tmux/cmd-split-window.c
+++ b/usr.bin/tmux/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-split-window.c,v 1.18 2010/01/07 20:02:01 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.19 2010/01/07 20:52:18 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -149,13 +149,14 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct session *s;
struct winlink *wl;
struct window *w;
- struct window_pane *wp, *new_wp;
+ struct window_pane *wp, *new_wp = NULL;
struct environ env;
char *cmd, *cwd, *cause;
const char *shell;
u_int hlimit;
int size;
enum layout_type type;
+ struct layout_cell *lc;
if ((wl = cmd_find_pane(ctx, data->target, &s, &wp)) == NULL)
return (-1);
@@ -193,13 +194,15 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if (*shell == '\0' || areshell(shell))
shell = _PATH_BSHELL;
- new_wp = window_add_pane(w, hlimit);
- if (window_pane_spawn(new_wp, cmd, shell, cwd, &env, s->tio, &cause) != 0)
- goto error;
- if (layout_split_pane(wp, type, size, new_wp) != 0) {
+ if ((lc = layout_split_pane(wp, type, size)) == NULL) {
cause = xstrdup("pane too small");
goto error;
}
+ new_wp = window_add_pane(w, hlimit);
+ if (window_pane_spawn(
+ new_wp, cmd, shell, cwd, &env, s->tio, &cause) != 0)
+ goto error;
+ layout_assign_pane(lc, new_wp);
server_redraw_window(w);