Mercurial > emacs
comparison lisp/window.el @ 31790:c31d17444869
(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.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 20 Sep 2000 19:31:56 +0000 |
parents | 766caf49d6a9 |
children | 569ef1445e17 |
comparison
equal
deleted
inserted
replaced
31789:ff5eb810214a | 31790:c31d17444869 |
---|---|
342 (interactive) | 342 (interactive) |
343 (save-selected-window | 343 (save-selected-window |
344 (if window | 344 (if window |
345 (select-window window) | 345 (select-window window) |
346 (setq window (selected-window))) | 346 (setq window (selected-window))) |
347 (let* ((params (frame-parameters)) | 347 (let* ((mini (frame-parameter nil 'minibuffer)) |
348 (mini (cdr (assq 'minibuffer params))) | |
349 (edges (window-edges))) | 348 (edges (window-edges))) |
350 (if (and (< 1 (count-windows)) | 349 (if (and (< 1 (count-windows)) |
351 (= (window-width) (frame-width)) | 350 (= (window-width) (frame-width)) |
352 (pos-visible-in-window-p (point-min) window) | 351 (pos-visible-in-window-p (point-min) window) |
353 (not (eq mini 'only)) | 352 (not (eq mini 'only)) |
354 (or (not mini) | 353 (or (not mini) |
355 (< (nth 3 edges) (nth 1 (window-edges mini))) | 354 (< (nth 3 edges) (nth 1 (window-edges mini))) |
356 (> (nth 1 edges) (cdr (assq 'menu-bar-lines params))))) | 355 (> (nth 1 edges) (frame-parameter nil 'menu-bar-lines)))) |
357 ;; `count-screen-lines' always works on the current buffer, so | 356 ;; `count-screen-lines' always works on the current buffer, so |
358 ;; make sure it is the buffer displayed by WINDOW. | 357 ;; make sure it is the buffer displayed by WINDOW. |
359 (let ((text-height (with-current-buffer (window-buffer window) | 358 (let ((text-height (with-current-buffer (window-buffer window) |
360 (count-screen-lines))) | 359 (count-screen-lines))) |
361 (window-height (window-height))) | 360 (window-height (window-height))) |
361 ;; This is a workaround that adds 1 line to the window | |
362 ;; if windows have a 3D mode-line. What's really needed | |
363 ;; is to get rid of the line-based computations. We don't | |
364 ;; have the infrastructure for doing so, yet. | |
365 (when (and (display-graphic-p) | |
366 (face-attribute 'mode-line :box)) | |
367 (setq text-height (1+ text-height))) | |
362 ;; Don't try to redisplay with the cursor at the end | 368 ;; Don't try to redisplay with the cursor at the end |
363 ;; on its own line--that would force a scroll and spoil things. | 369 ;; on its own line--that would force a scroll and spoil things. |
364 (when (and (eobp) (bolp) (not (bobp))) | 370 (when (and (eobp) (bolp) (not (bobp))) |
365 (forward-char -1)) | 371 (forward-char -1)) |
366 (when (> window-height (1+ text-height)) | 372 (when (> window-height (1+ text-height)) |