comparison lisp/window.el @ 34580:6745d4dc1458

(mode-line-window-height-fudge): Function removed. (height-affecting-face-attributes, mode-line-window-height-fudge): Variables removed.
author Miles Bader <miles@gnu.org>
date Fri, 15 Dec 2000 01:11:04 +0000
parents 6a8eb5041120
children 62272f68e460
comparison
equal deleted inserted replaced
34579:432f2f4182cd 34580:6745d4dc1458
278 (let ((old-w (selected-window)) 278 (let ((old-w (selected-window))
279 (size (and arg (prefix-numeric-value arg)))) 279 (size (and arg (prefix-numeric-value arg))))
280 (and size (< size 0) 280 (and size (< size 0)
281 (setq size (+ (window-width) size))) 281 (setq size (+ (window-width) size)))
282 (split-window-save-restore-data (split-window nil size t) old-w))) 282 (split-window-save-restore-data (split-window nil size t) old-w)))
283
284 (defcustom mode-line-window-height-fudge nil
285 "*Fudge factor returned by `mode-line-window-height-fudge' on graphic displays.
286 If non-nil, it should be the number of lines to add to the sizes of
287 windows to compensate for the extra height of the mode-line, so it
288 doesn't't obscure the last line of text.
289
290 If nil, an attempt is made to calculate reasonable value.
291
292 This is a kluge."
293 :type '(choice (const :tag "Guess" nil)
294 (integer :tag "Extra lines" :value 1))
295 :group 'windows)
296
297 ;; List of face attributes that might change a face's height
298 (defconst height-affecting-face-attributes
299 '(:family :height :box :font :inherit))
300
301 (defsubst mode-line-window-height-fudge (&optional face)
302 "Return a fudge factor to compensate for the extra height of graphic mode-lines.
303 On a non-graphic display, return 0.
304
305 FACE is the face used to display the mode-line; it defaults to `mode-line'.
306
307 If the variable `mode-line-window-height-fudge' has a non-nil value, it
308 is returned. Otherwise, the `mode-line' face is checked to see if it
309 contains any attributes that might affect its height; if it does, 1 is
310 returned, otherwise 0.
311
312 \[Because mode-lines on a graphics capable display may have a height
313 larger than a normal text line, a window who's size is calculated to
314 exactly show some text, including 1 line for the mode-line, may be
315 displayed with the last text line obscured by the mode-line.
316
317 To work-around this problem, call `mode-line-window-height-fudge', and
318 add the return value to the requested window size.]
319
320 This is a kluge."
321 (if (display-graphic-p)
322 (or
323 ;; Return user-specified value
324 mode-line-window-height-fudge
325 ;; Try and detect whether mode-line face has any attributes that
326 ;; could make it bigger than a default text line, and return a
327 ;; fudge factor of 1 if so.
328 (let ((attrs height-affecting-face-attributes)
329 (fudge 0))
330 (while attrs
331 (let ((val (face-attribute (or face 'mode-line) (pop attrs))))
332 (unless (or (null val) (eq val 'unspecified))
333 (setq fudge 1 attrs nil))))
334 fudge))
335 0))
336 283
337 284
338 (defun set-window-text-height (window height) 285 (defun set-window-text-height (window height)
339 "Sets the height in lines of the text display area of WINDOW to HEIGHT. 286 "Sets the height in lines of the text display area of WINDOW to HEIGHT.
340 This doesn't include the mode-line (or header-line if any) or any 287 This doesn't include the mode-line (or header-line if any) or any