summaryrefslogtreecommitdiffstats
path: root/cmd-kill-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-07-18 11:07:14 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-07-18 11:07:14 +0000
commit19cb1fb592527e1800d6ae6f761b2a8ab944ef5d (patch)
tree24ab810190090efe17f7357099331f99d0a3c527 /cmd-kill-window.c
parentc30fbd1d8d2c3e0b85678db8de8204189f9a67f8 (diff)
Make it so using kill-pane to destroy the last pane in a window destroys the
window instead of being an error.
Diffstat (limited to 'cmd-kill-window.c')
-rw-r--r--cmd-kill-window.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index 397ffff9..6f467713 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-window.c,v 1.17 2009-07-15 17:45:09 nicm Exp $ */
+/* $Id: cmd-kill-window.c,v 1.18 2009-07-18 11:07:14 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,37 +44,11 @@ cmd_kill_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;
- struct client *c;
- u_int i, j;
- int destroyed;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
return (-1);
- w = wl->window;
- for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
- s = ARRAY_ITEM(&sessions, i);
- if (s == NULL || !session_has(s, w))
- continue;
- if ((wl = winlink_find_by_window(&s->windows, w)) == NULL)
- continue;
-
- destroyed = session_detach(s, wl);
- for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
- c = ARRAY_ITEM(&clients, j);
- if (c == NULL || c->session != s)
- continue;
-
- if (destroyed) {
- c->session = NULL;
- server_write_client(c, MSG_EXIT, NULL, 0);
- } else
- server_redraw_client(c);
- }
- }
- recalculate_sizes();
+ server_kill_window(wl->window);
return (0);
}