summaryrefslogtreecommitdiffstats
path: root/cmd-split-window.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-01-08 16:23:38 +0000
committerTiago Cunha <tcunha@gmx.com>2010-01-08 16:23:38 +0000
commit91b7db766c694100c3eb736bcc540540fc7643bf (patch)
treebd4a4cff393617e8e17aa0f592990f12daa6f512 /cmd-split-window.c
parent7c3d4e35d71c5d1f10ac432c842852b2448ab2f8 (diff)
Sync OpenBSD patchset 600:
Change split-window to accept a pane target (it should be split-pane but renaming the command would be annoying).
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r--cmd-split-window.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c
index 3dfe2ea8..a7bb513e 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-split-window.c,v 1.31 2009-12-04 22:14:47 tcunha Exp $ */
+/* $Id: cmd-split-window.c,v 1.32 2010-01-08 16:23:38 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,7 +44,7 @@ struct cmd_split_window_data {
const struct cmd_entry cmd_split_window_entry = {
"split-window", "splitw",
- "[-dhv] [-p percentage|-l size] [-t target-window] [command]",
+ "[-dhv] [-p percentage|-l size] [-t target-pane] [command]",
0, "",
cmd_split_window_init,
cmd_split_window_parse,
@@ -148,7 +148,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct session *s;
struct winlink *wl;
struct window *w;
- struct window_pane *wp;
+ struct window_pane *wp, *new_wp;
struct environ env;
char *cmd, *cwd, *cause;
const char *shell;
@@ -156,7 +156,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
int size;
enum layout_type type;
- if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
+ if ((wl = cmd_find_pane(ctx, data->target, &s, &wp)) == NULL)
return (-1);
w = wl->window;
@@ -192,10 +192,10 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if (*shell == '\0' || areshell(shell))
shell = _PATH_BSHELL;
- wp = window_add_pane(w, hlimit);
- if (window_pane_spawn(wp, cmd, shell, cwd, &env, s->tio, &cause) != 0)
+ 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(w->active, type, size, wp) != 0) {
+ if (layout_split_pane(wp, type, size, new_wp) != 0) {
cause = xstrdup("pane too small");
goto error;
}
@@ -203,7 +203,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
server_redraw_window(w);
if (!data->flag_detached) {
- window_set_active_pane(w, wp);
+ window_set_active_pane(w, new_wp);
session_select(s, wl->idx);
server_redraw_session(s);
} else
@@ -214,8 +214,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
error:
environ_free(&env);
- if (wp != NULL)
- window_remove_pane(w, wp);
+ if (new_wp != NULL)
+ window_remove_pane(w, new_wp);
ctx->error(ctx, "create pane failed: %s", cause);
xfree(cause);
return (-1);