bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38181: Actual height of mode-line not taken into account


From: Jonas Bernoulli
Subject: bug#38181: Actual height of mode-line not taken into account
Date: Tue, 12 Nov 2019 17:52:59 +0100
User-agent: mu4e 1.1.0; emacs 27.0.50

If the height of the mode-line is increased by inserting an image into
it, then that height is not taken into account in a buffer/window until
`redisplay' has been called at least once since the buffer was created.

This function can be used for testing:

(defun test-popup ()
  (interactive)
  (with-current-buffer (generate-new-buffer "*test*")
    (save-excursion
      (insert "one\ntwo\nthree\nfour\nfive"))
    (let ((win (display-buffer (current-buffer)
                               '(display-buffer-in-side-window
                                 (side . bottom)))))
      ;; (redisplay)
      (fit-window-to-buffer win))))

First we can see that if we increase the height by modifying the
`mode-line' and `mode-line-inactive' faces, then that IS taken into
account.

(set-face-attribute 'mode-line nil :height 250)
(set-face-attribute 'mode-line-inactive nil :height 250)

Now decrease the height again and try this instead:

(setq-default
 mode-line-format
 (cons (propertize " " 'display
                   (create-image "/* XPM */ static char * image[] = {
\"3 60 1 1\",
\"0 c #00aaff\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\",
\"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\"
};" 'xpm t :ascent 'center))
       mode-line-format))

When you call the command now, then the lower parts of the buffer are
not visible because the window is not high enough.

A work-around is to call `redisplay' before calling
`fit-window-to-buffer', which could be done by advising that function.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]