Subject: Re: bug#38828: 26.3; Customized mode line breaks height of vertical scroll bar

From: Eli Zaretskii <[email-masked]>
Date: Thu, 02 Jan 2020 21:58:49 +0200

> Cc: [email-masked]
> From: martin rudalics <[email-masked]>
> Date: Thu, 2 Jan 2020 20:19:05 +0100
> 
>  > There's more than one problem here (didn't you wonder why pressing F3
>  > doesn't immediately redraw the mode line?).
> 
> It never did that unless I changed the size of some window too, so why
> should I have wondered?

Well, because if you don't do anything after F3, the mode line stays
without update forever.

> How expensive is watching a variable?

Just an extra 'if' in a few places where we set the variable, to check
if it's being watched.  Grep the sources for SYMBOL_TRAPPED_WRITE.

> So far I was convinced this would be used for debugging purposes only.

You can see at the end of frame.el we have a list of variables we
watch that have nothing to do with debugging.

> What does "resizing a window without allocating new rows" encompass?
> Is this only shrinking the window height ('shrink-/split-window') or
> also making a special line like the mode line taller (eating away some
> of the remaining matrix lines, naively spoken)?

Glyph matrices don't care about the pixel size of the window, they
only care about the maximum number of glyph rows they can
accommodate.  So increasing the size of a mode line has the effect of
making the window's glyph matrices use fewer rows (assuming the
window's pixel size doesn't change).  In addition, a GUI window
usually has a matrix allocated for more rows than it actually uses,
which is why each matrix has both 'nrows' and 'rows_allocated'
members, and the former is likely to be smaller than the latter.  When
a window's resize needs less rows that 'rows_allocated', there's no
reallocation, just a change in the 'nrows' field.

But I now think that we need to reset the mode_line_p flag even if we
reallocate, because the rows which existed before reallocation are
copied to the enlarged matrix, so that flag is kept.  So I think I
will install the patch with that small change.