Subject: bug#38563: 27.0.50; Company popup renders with newlines (?) inheriting the bg properties of the character at next line's bol

From: Eli Zaretskii <[email-masked]>
Date: Fri, 13 Dec 2019 16:12:02 +0200

> Cc: [email-masked]
> From: Dmitry Gutov <[email-masked]>
> Date: Fri, 13 Dec 2019 12:17:06 +0200
> 
> > That's not a bug: the face on that thin line on whose first character
> > you put the tooltip overlay has a non-nil :extend attribute, so
> > Company will have to explicitly say ':extend nil' in its face(s) to
> > countermand that.  Recall that a string from a display property merges
> > into its face all the attributes from the "underlying" face, so with
> > the current :extend machinery it is no longer enough just to specify a
> > background color in the display string's face, as you did before.
> 
> I see. But isn't the issue that the background from the underlying face 
> is used at all, rather that it's extended?

Yes and no.  See below.

> But I suppose I could add a face with ':extend nil' and use it in place 
> of 'default' there.

It wouldn't have worked, because ':extend nil' means the face which
says this is ineligible for face merging when face extension is
considered.  IOW, ':extend nil' cannot countermand some other face
that's being merged which says ':extend t'.

> > Previously, whether a face's background was extended to EOL was
> > determined only by the background color of the newline; now the
> > :extend attribute determines that independently of the background
> > color.
> 
> ...but the background color is taken specifically from the face that 
> specified :extend?

The problem is that the company's tooltip faces don't say ':extend t',
so they are ineligible for merging when the face beyond EOL is
considered.  The only face which was eligible was the face of the
first character of the line where you place your overlay.  Even if it
doesn't have ':extend t', we treat the base face (the first one being
merged) specially: we always treat it as eligible (ever wondered how
come 'default', 'tool-bar', and other "basic" faces get extended
although they don't specify :extend?).

The latest changes simply reset the :extend attribute of the "basic"
face used in the merge process, since I believe this is expected in
all the use cases (fingers crossed that no one comes with a valid use
case where it's not TRT).