Subject: bug#11068: 24.0.94; Face-remapped background does not extend to end of window

From: Eli Zaretskii <[email-masked]>
Date: Sun, 25 Mar 2012 19:22:25 +0200

> Date: Sun, 25 Mar 2012 14:54:12 +0200
> From: martin rudalics <[email-masked]>
> CC: [email-masked], [email-masked], 
>  [email-masked], [email-masked]
> 
>  > What the changes I suggested do is add stretch glyphs of a suitably
>  > computed width to each glyph row that has no text in it.  The changes
>  > are small because the code that does that was already written for the
>  > bidirectional display, which needs to display R2L lines flushed all
>  > the way to the right margin of the window; it does that by prepending
>  > such a stretch glyph to the R2L glyph rows, ahead (i.e to the left) of
>  > the text.  All I needed was to activate that code for the case of
>  > remapped default face, in addition to R2L lines.
> 
> Consider the following example: In my .emacs I do for ages
> 
> (custom-set-faces
>   '(font-lock-comment-face ((((class color) (background light)) (:background "Beige" :foreground "Black")))))
> 
> Evaluate this form with emacs -Q in *scratch* and you will see that the
> background color extends from each buffer line end to the right window
> edge.

Yes, that's true (and well known).

> Anyway, my conclusion from this example is that even in normal L2R text
> Emacs somehow constructs a stretch glyph (or whatever else) to simulate
> the effect of text properties over some virtual text.

Correct.  But only for lines that end before EOB.  The line that ends
_at_ EOB and all the subsequent lines don't have this stretch glyph.
The changes I did introduce such stretch glyphs for _all_ lines in the
window than don't already have them.

> I assume that your solution does something equivalent for every
> virtual buffer line that is missing down to the bottom of the
> window.

Yes.

> And it takes the face property not from the return character but
> from the remapped default face.

No, the return character has no face, and in fact it has no glyphs.
The original code would reset the face to the (un-remapped) default
face when it hits the line at EOB, and would not draw past EOB at all,
instead relying on the display-specific code that clears the rest of
the window with the default color.  Since now there are stretch glyphs
there, we do draw in those areas, and we draw in the precise face that
remapping specifies.

> Apart from that why do you need a solution from R2L lines here?

Nothing, I just reused the machinery that was invented for R2L lines.

> As an aside I earlier tried to achieve the effect of your patch by
> adding an overlay with an after-string containing an appropriate number
> of return characters to the last character of each buffer.  It didn't
> work and I still consider that a bug.

If you show me the code, I will see if it's a bug or something else.