diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-10-20 04:33:34 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-10-20 04:33:34 +0000 |
commit | 8d879753ea52157fa734bba12e3a15656e1476f9 (patch) | |
tree | b3854304441fe220523150ff63c22e25ca719cbb /src/window.c | |
parent | be58e187e675d1d5a9a0a4ce13900a28a1bff07e (diff) | |
download | emacs-8d879753ea52157fa734bba12e3a15656e1476f9.tar.gz |
(Fdisplay_buffer): If the other window is smaller
than its peer, even out their heights.
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c index c6c95e68405..96588a8623d 100644 --- a/src/window.c +++ b/src/window.c @@ -1946,6 +1946,8 @@ Returns the window displaying BUFFER.") window = Fsplit_window (window, Qnil, Qnil); else { + Lisp_Object upper, lower, other; + window = Fget_lru_window (frames); /* If the LRU window is selected, and big enough, and can be split, split it. */ @@ -1974,6 +1976,24 @@ Returns the window displaying BUFFER.") if (NILP (window)) window = Fframe_first_window (Fselected_frame ()); #endif + /* If window appears above or below another, + even out their heights. */ + if (!NILP (XWINDOW (window)->prev)) + other = upper = XWINDOW (window)->prev, lower = window; + if (!NILP (XWINDOW (window)->next)) + other = lower = XWINDOW (window)->next, upper = window; + if (!NILP (other) + /* Check that OTHER and WINDOW are vertically arrayed. */ + && XWINDOW (other)->top != XWINDOW (window)->top + && XWINDOW (other)->height > XWINDOW (window)->height) + { + int total = XWINDOW (other)->height + XWINDOW (window)->height; + struct window *old_selected_window = selected_window; + + selected_window = XWINDOW (upper); + change_window_height (total / 2 - XWINDOW (upper)->height, 0); + selected_window = old_selected_window; + } } } else |