diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-19 16:00:55 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-19 16:00:55 +0000 |
commit | b1782e1b3d2df83c68314427d4ea65e4e14698eb (patch) | |
tree | a0f514497e7440c213b5ff917f38d9dba7962989 /window.c | |
parent | e3440e017dead90510f81fbde5323a1c8e91173d (diff) |
Truncate array if last window is closed.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.5 2007-09-19 15:16:23 nicm Exp $ */ +/* $Id: window.c,v 1.6 2007-09-19 16:00:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -158,7 +158,10 @@ window_remove(struct windows *ww, struct window *w) if (window_index(ww, w, &i) != 0) fatalx("window not found"); - ARRAY_SET(ww, i, NULL); + if (i != ARRAY_LENGTH(ww) - 1) + ARRAY_SET(ww, i, NULL); + else + ARRAY_TRUNC(ww, 1); w->references--; if (w->references == 0) { |