- maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep)
- : !NILP (p->next) ? ((*sizefun) (p->next)
- - window_min_size (XWINDOW (p->next),
- widthflag, 0, 0))
- : !NILP (p->prev) ? ((*sizefun) (p->prev)
- - window_min_size (XWINDOW (p->prev),
- widthflag, 0, 0))
- /* This is a frame with only one window, a minibuffer-only
- or a minibufferless frame. */
- : (delta = 0));
+ /* Compute the maximum size increment this window can have. */
+
+ if (preserve_before)
+ {
+ if (!NILP (parent))
+ {
+ maxdelta = (*sizefun) (parent) - XINT (*sizep);
+ /* Subtract size of siblings before, since we can't take that. */
+ maxdelta -= XINT (CURBEG (window)) - XINT (CURBEG (parent));
+ }
+ else
+ maxdelta = (!NILP (p->next) ? ((*sizefun) (p->next)
+ - window_min_size (XWINDOW (p->next),
+ widthflag, 0, 0))
+ : (delta = 0));
+ }
+ else
+ maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep)
+ /* This is a main window followed by a minibuffer. */
+ : !NILP (p->next) ? ((*sizefun) (p->next)
+ - window_min_size (XWINDOW (p->next),
+ widthflag, 0, 0))
+ /* This is a minibuffer following a main window. */
+ : !NILP (p->prev) ? ((*sizefun) (p->prev)
+ - window_min_size (XWINDOW (p->prev),
+ widthflag, 0, 0))
+ /* This is a frame with only one window, a minibuffer-only
+ or a minibufferless frame. */
+ : (delta = 0));