summaryrefslogtreecommitdiffstats
path: root/cmd-respawn-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-11 23:31:46 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-11 23:31:46 +0000
commit162bacdcd91caf631db6979a21c27d208a66046b (patch)
treed678a35fa4c017ec034d6d6b19140f56fd8ca65a /cmd-respawn-window.c
parentd78bc5dfc40fe8d1a3842bd91dcfa5ca4c44ae01 (diff)
Window splitting. Two vertical panes fixed 50% each. This is a huge diff, still a couple of bugs (notably heap corruption somewhere causing segfault on exit).
Diffstat (limited to 'cmd-respawn-window.c')
-rw-r--r--cmd-respawn-window.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index 20002c3e..4590206c 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-respawn-window.c,v 1.6 2009-01-10 19:37:35 nicm Exp $ */
+/* $Id: cmd-respawn-window.c,v 1.7 2009-01-11 23:31:46 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -46,6 +46,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct winlink *wl;
+ struct window *w;
struct session *s;
const char *env[] = {
NULL /* TMUX= */, "TERM=screen", NULL
@@ -55,8 +56,10 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
return;
+ w = wl->window;
- if (wl->window->fd != -1 && !(data->flags & CMD_KFLAG)) {
+ if ((w->panes[0]->fd != -1 || (w->panes[1] != NULL &&
+ w->panes[1]->fd != -1)) && !(data->flags & CMD_KFLAG)) {
ctx->error(ctx, "window still active: %s:%d", s->name, wl->idx);
return;
}
@@ -66,14 +69,17 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
xsnprintf(buf, sizeof buf, "TMUX=%ld,%u", (long) getpid(), i);
env[0] = buf;
- if (window_spawn(wl->window, data->arg, wl->window->cwd, env) != 0) {
+ if (w->panes[1] != NULL)
+ window_remove_pane(w, 1);
+
+ if (window_pane_spawn(w->panes[0], data->arg, NULL, env) != 0) {
ctx->error(ctx, "respawn failed: %s:%d", s->name, wl->idx);
return;
}
- screen_reinit(&wl->window->base);
+ screen_reinit(&w->panes[0]->base);
recalculate_sizes();
- server_redraw_window(wl->window);
+ server_redraw_window(w);
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);