Subject: bug#21835: 25.0.50; cursor height wrong when line-spacing is used

From: David Reitter <[email-masked]>
Date: Thu, 5 Nov 2015 22:12:03 -0500

Hi Eli,

On Nov 5, 2015, at 11:12 AM, Eli Zaretskii <[email-masked]> wrote:

>> (setq line-spacing 1.0)
>> 
>> (Note how the display doesn’t update, so enter C-l to force it)
> 
> It does update for me if I evaluate that with C-j at the right
> parenthesis.  How did you evaluate it?

C-x C-e.  
C-j, indeed, updates the display.

> Strange as it might sound, this is not a bug, but intended behavior.
> It is a consequence of improvements in display code that avoid
> extremely large lines with some fonts (in particular, math fonts) that
> declare preposterously large font sizes.  Previously, the line height,
> and the height of the cursor at EOL, was determined by the font-global
> ascent/descent values.  We now determine the height of the line by
> looking at the glyphs we actually display on that line.  See bug#20628
> for more details.

That, in principle, should not be a problem - if you indeed determine a line height rather than a glyph height (at the cursor) and use that for the cursor anywhere in that line.  But...

> The problem with displaying the cursor at the end of the line is that
> there's no displayable glyph there, whose dimensions in the font we
> could use to determine the cursor height.  So we set the cursor height
> to the line height.

That creates an inconsistency, and it looks bad.  

So, you’re asking, what did I have in mind?

One could default to the height of the last glyph of the line. Normally, we would expect the size of the cursor to indicate the general height of the text that would be inserted there, and the last glyph is the best guess.

Alternatively, use the line height for all cursor positions in that line.  In that case, things would still need to be adjusted for `line-spacing’, and based on what you wrote, I think that’s less preferable.