Subject: bug#23574: 24.5; Overzealous underlining in emacs-nox

From: Eli Zaretskii <[email-masked]>
Date: Wed, 08 Jun 2016 20:05:34 +0300

> Date: Wed, 08 Jun 2016 08:33:30 +0200
> From: martin rudalics <[email-masked]>
> CC: [email-masked], [email-masked], 
>  [email-masked], [email-masked]
> 
> This has the advantage of a much better doc-string.  The only details
> missing are whether the last character of a line is the newline
> character, whether a non-printable character's attributes count, how
> invisible characters are treated and whether the :display attribute has
> any impact.  Since I have no good idea about all of these I deliberately
> did not try to cover them.

I do know about these, but I don't thunk we should document all those
details, since there are too many possible variations, and it's too
easy to be inaccurate.  "the last face used on the line" is good
enough, I think.

> I'm not sure whether your proposal (it obviously was my first idea as
> well) is less expensive, though.  If the value of our variable is a
> list, the display engine has to go through the properties of the last
> character and compare them against the members of this list.  Or go
> through all members of the list and compare them against the character's
> properties - neither of these approaches is cheap even if optimizations
> are applied.

No, it need not do any of that.  The list is fixed for each redisplay
cycle of each buffer, so the list can be processed only once into a
bitmap of flags that tell which face attributes trigger face
extension.  Then all redisplay needs to do is compare the attributes
of the face loaded into the iterator object at end of each line with
these flags.

> And then I thought about the - possibly silly idea - that a user might
> want to put a property like :background on all lines displayed,
> regardless of the last character's attributes.  Such a user would have
> to, before displaying the relevant buffer parts, go through all these
> lines and add that property to the newline (?) character of each line.
> Now I bet that the greater part of such users would put the property on
> all newline characters of the buffer instead of using something like
> ‘pre-redisplay-functions’ where even I couldn't tell whether it gets the
> window's start and end positions always right.

Hmm.. not sure how this is related.