From daf516d34f94c460e018770b8cd6bc59153913d5 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 18 Jan 2002 03:50:50 +0000 Subject: [PATCH] (enlarge_window): When exceeding size of parent, directly delete all the siblings instead of trying to resize it. --- src/ChangeLog | 5 +++++ src/window.c | 46 ++++++++++++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 813cfc9bb53..69292345488 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-01-17 Richard M. Stallman + + * window.c (enlarge_window): When exceeding size of parent, + directly delete all the siblings instead of trying to resize it. + 2002-01-17 Pavel Jan,Bm(Bk * term.c (set_tty_color_mode): Remove unused variable `tem'. diff --git a/src/window.c b/src/window.c index e3914f8f97a..be2f6330bf4 100644 --- a/src/window.c +++ b/src/window.c @@ -3543,11 +3543,24 @@ enlarge_window (window, delta, widthflag, preserve_before) register int delta1; register int opht = (*sizefun) (parent); - /* If trying to grow this window to or beyond size of the parent, - make delta1 so big that, on shrinking back down, - all the siblings end up with less than one line and are deleted. */ if (opht <= XINT (*sizep) + delta) - delta1 = opht * opht * 2; + { + /* If trying to grow this window to or beyond size of the parent, + just delete all the sibling windows. */ + Lisp_Object tem, next; + + tem = XWINDOW (parent)->vchild; + if (NILP (tem)) + tem = XWINDOW (parent)->hchild; + + while (! NILP (tem)) + { + next = XWINDOW (tem)->next; + if (!EQ (tem, window)) + delete_window (tem); + tem = next; + } + } else { /* Otherwise, make delta1 just right so that if we add @@ -3590,19 +3603,20 @@ enlarge_window (window, delta, widthflag, preserve_before) ++n; delta1 = n * delta; - } - /* Add delta1 lines or columns to this window, and to the parent, - keeping things consistent while not affecting siblings. */ - XSETINT (CURSIZE (parent), opht + delta1); - (*setsizefun) (window, XINT (*sizep) + delta1, 0); - - /* Squeeze out delta1 lines or columns from our parent, - shriking this window and siblings proportionately. - This brings parent back to correct size. - Delta1 was calculated so this makes this window the desired size, - taking it all out of the siblings. */ - (*setsizefun) (parent, opht, 0); + /* Add delta1 lines or columns to this window, and to the parent, + keeping things consistent while not affecting siblings. */ + XSETINT (CURSIZE (parent), opht + delta1); + (*setsizefun) (window, XINT (*sizep) + delta1, 0); + + /* Squeeze out delta1 lines or columns from our parent, + shriking this window and siblings proportionately. + This brings parent back to correct size. + Delta1 was calculated so this makes this window the desired size, + taking it all out of the siblings. */ + (*setsizefun) (parent, opht, 0); + + } } XSETFASTINT (p->last_modified, 0); -- 2.39.5