[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#42552: 28.0.50; Overlay 'face' property doesn't set the "underlying

From: Dmitry Gutov
Subject: bug#42552: 28.0.50; Overlay 'face' property doesn't set the "underlying face" for 'after-string'
Date: Wed, 5 Aug 2020 02:55:59 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 03.08.2020 18:09, Eli Zaretskii wrote:
Cc: 42552@debbugs.gnu.org
From: Dmitry Gutov <dgutov@yandex.ru>
Date: Mon, 3 Aug 2020 02:37:37 +0300

But the installed fix doesn't solve the other scenario, depicted on the
second screenshot attached to this report:

Do you need a step-by-step repro for that?

The reason for that difference seems to be that it's a log-edit buffer,
and the delimiter line is fontified using an anonymous face '(:height
0.1 :inverse-video t :extend t), see the end of log-edit-font-lock-keywords.

When the underlying face has the :extend attribute set, we must obey
it.  So what you see in that case is the expected behavior.

Should the "overlay string" obey the underlying face, though? It doesn't obey the 'face' property, like you explained. Seems inconsistent.

Still, Emacs 26.3 doesn't exhibit this problem, and in that version the
contents of that anonymous face was the same (except without :extend t,
but back then, all faces did "extend"). (*)

Emacs 26 and before simply extended the face of the last character of
the line.  Emacs 27 doesn't do that, it examines the faces in effect
anew, filtering out those which don't have the :extend attribute set,
so the result is different.  This is exactly the change in behavior
that was intended, not a bug.

But it should obey :extend set to nil, shouldn't it?

Would it be too hard to have the same behavior in 28+?

You can have this in Emacs > 26 if you make the face of the last
character have the :extend attribute set, so that its background color
overrides that of the one of the underlying buffer text.  E.g., you
could define a face that inherits from 'default', and if that doesn't
specify the background color,

From what I can tell, 'default' specifies '#ffffff' background on my machine. It also sets :extend to nil.

In the diff attached to the report (which is part of the reproduction scenario), you can see the whole overlay string's 'face' property being appended with the value 'default'. It doesn't seem to help.

Even if I replace 'default' in there with a custom face that sets ':extend' to nil, the result is the same.

use the frame's background as fallback
to set that face's background.

I suppose you mean the custom face must have :extend set to t, and have a :background value computed right before it is used (otherwise the user might customize the faces mid-session, leading to bad visuals).

That seems to work. It also has the significant benefit on working in Emacs 27, so if that's the approach you recommend in the end, the fix you already pushed to master might be unnecessary.

I don't see how else to get the behavior you want when using overlay
strings.  The only alternative is to move the position where you place
the overlay outside the problematic face, but that is probably
undesirable for other reasons.

It's just hard to do. And there might be no such position anywhere nearby.

Furthermore, in Emacs 26.3 I can propertize the newlines in the overlay
string with '(face region) and see the "extend" effect. Or keep them
with 'default' face and see no "extend" effect on those lines.

You are saying that this doesn't work in Emacs >= 27?

One works, the other doesn't.

       Like face_at_buffer_position except for OVERLAY.  Currently it
       simply disregards the `face' properties of all overlays.  */

    face_for_overlay_string (struct window *w, ptrdiff_t pos,

But it works! That's how we closed bug#38563, didn't we?

It works with display strings, yes.  You now want to switch to overlay
strings, and the rules of collecting faces are subtly different there.

Hmm, so 'after-string' and 'before-string' are overlay strings, but 'display' set on an overlay is not an overlay string. Okay then.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]