From 1ec082d4f7d3ea6afb5d15c85a874e8687a23ba5 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Wed, 20 Sep 2000 19:32:17 +0000 Subject: [PATCH] (shrink-window-if-larger-than-buffer): If face `mode-line' has a :box, and we're on a graphical frame, add 1 to the needed window height. --- lisp/ChangeLog | 4 ++++ lisp/window.el | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8bcb27f6727..8d4d67b14cf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2000-09-20 Gerd Moellmann + * window.el (shrink-window-if-larger-than-buffer): If face + `mode-line' has a :box, and we're on a graphical frame, add 1 + to the needed window height. + * frame.el (frame-notice-user-settings): Add a last parameter nil to a call to `append', because the last list passed to `append' is not copied, and so subsequent calls to assq-delete-all will modify diff --git a/lisp/window.el b/lisp/window.el index 81d35cef894..31735c093f5 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -344,8 +344,7 @@ or if the window is the only window of its frame." (if window (select-window window) (setq window (selected-window))) - (let* ((params (frame-parameters)) - (mini (cdr (assq 'minibuffer params))) + (let* ((mini (frame-parameter nil 'minibuffer)) (edges (window-edges))) (if (and (< 1 (count-windows)) (= (window-width) (frame-width)) @@ -353,12 +352,19 @@ or if the window is the only window of its frame." (not (eq mini 'only)) (or (not mini) (< (nth 3 edges) (nth 1 (window-edges mini))) - (> (nth 1 edges) (cdr (assq 'menu-bar-lines params))))) + (> (nth 1 edges) (frame-parameter nil 'menu-bar-lines)))) ;; `count-screen-lines' always works on the current buffer, so ;; make sure it is the buffer displayed by WINDOW. (let ((text-height (with-current-buffer (window-buffer window) (count-screen-lines))) (window-height (window-height))) + ;; This is a workaround that adds 1 line to the window + ;; if windows have a 3D mode-line. What's really needed + ;; is to get rid of the line-based computations. We don't + ;; have the infrastructure for doing so, yet. + (when (and (display-graphic-p) + (face-attribute 'mode-line :box)) + (setq text-height (1+ text-height))) ;; Don't try to redisplay with the cursor at the end ;; on its own line--that would force a scroll and spoil things. (when (and (eobp) (bolp) (not (bobp))) -- 2.39.2