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

From: martin rudalics <[email-masked]>
Date: Sun, 17 Nov 2019 10:01:44 +0100

> Maybe fit-window-to-buffer should set some hook, which redisplay
 > should call if it finds out that the mode-line height changed?

Maybe a two-bits sticky bit-field in the window structure called
refit_window_to_buffer.  The Lisp interface to it is a function called
'refit-window-to-buffer' setting refit_window_to_buffer to 1 if it is
zero.  'fit-window-to-buffer' always calls 'refit-window-to-buffer'.

display_mode_lines sets refit_window_to_buffer to 2 provided it is 1
and the mode line height of this window has changed.  The display
engine eventually calls 'fit-window-to-buffer' for all windows that
have refit_window_to_buffer equal 2 and sets it to 3.  When the
display engine is done with redisplay it resets refit_window_to_buffer
for all windows to 0.

This might be tricky for windows stored in configurations and states.
And always remember the fact that in one and the same display cycle
'fit-window-to-buffer' may have been called for two windows above each
other.  So this is definitely not for Emacs 27.

martin