diff options
author | Jan Djärv <[email protected]> | 2005-06-06 10:38:40 +0000 |
---|---|---|
committer | Jan Djärv <[email protected]> | 2005-06-06 10:38:40 +0000 |
commit | 5494d7bcdba82b2c33278b8d37fee6b0c9bd14e5 (patch) | |
tree | 03a28a160a585f5081c53bd25a83d8f6215a1f83 /src | |
parent | eb78dfb8dd75c2989d0a20c327b6ec4e6e78ce11 (diff) |
* window.c (delete_window): Handle the case where a h/vchild has
a h/vchild.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/window.c | 49 |
2 files changed, 53 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f5bbebbb76..308d55187d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-06-06 Jan Dj,Ad(Brv <[email protected]> + + * window.c (delete_window): Handle the case where a h/vchild has + a h/vchild. + 2005-06-05 Eli Zaretskii <[email protected]> * w32.c (sys_setsockopt): Change arg 4 to `const void *'. In the diff --git a/src/window.c b/src/window.c index faf88c91ff..4839830b17 100644 --- a/src/window.c +++ b/src/window.c @@ -1452,8 +1452,10 @@ delete_window (window) tem = par->hchild; if (NILP (tem)) tem = par->vchild; - if (NILP (XWINDOW (tem)->next)) + if (NILP (XWINDOW (tem)->next)) { replace_window (parent, tem); + par = XWINDOW (tem); + } /* Since we may be deleting combination windows, we must make sure that not only p but all its children have been marked as deleted. */ @@ -1465,6 +1467,51 @@ delete_window (window) /* Mark this window as deleted. */ p->buffer = p->hchild = p->vchild = Qnil; + if (! NILP (par->parent)) + par = XWINDOW (par->parent); + + /* Check if we have a v/hchild with a v/hchild. In that case remove + one of them. */ + + if (! NILP (par->vchild) && ! NILP (XWINDOW (par->vchild)->vchild)) + { + p = XWINDOW (par->vchild); + par->vchild = p->vchild; + tem = p->vchild; + } + else if (! NILP (par->hchild) && ! NILP (XWINDOW (par->hchild)->hchild)) + { + p = XWINDOW (par->hchild); + par->hchild = p->hchild; + tem = p->hchild; + } + else + p = 0; + + if (p) + { + while (! NILP (tem)) { + XWINDOW (tem)->parent = p->parent; + if (NILP (XWINDOW (tem)->next)) + break; + tem = XWINDOW (tem)->next; + } + if (! NILP (tem)) { + /* The next of the v/hchild we are removing is now the next of the + last child for the v/hchild: + Before v/hchild -> v/hchild -> next1 -> next2 + | + -> next3 + After: v/hchild -> next1 -> next2 -> next3 + */ + XWINDOW (tem)->next = p->next; + if (! NILP (p->next)) + XWINDOW (p->next)->prev = tem; + } + p->next = p->prev = p->vchild = p->hchild = p->buffer = Qnil; + } + + /* Adjust glyph matrices. */ adjust_glyphs (f); UNBLOCK_INPUT; |