Subject: bug#39245: 26.3; 'mouse-face highlighting is extended beyond EOB

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 28 Oct 2020 13:36:09 +0100

[email-masked] writes:

> If a buffer does not end with a newline and 'mouse-face property is
> added at the last character, 'mouse-face highlighting covers the blank
> area to the right of the last character.
>
> If 'mouse-face region contains newline characters,
> the blank area to the right of the last character is not highlighted.
>
> Example: Evaluate the form below and move the mouse pointer onto 'XYZ'.
> Then the blank area to the right of 'Z' is highlighted.
> If a newline character is inserted between 'X' and 'Y',
> the blank area to the right of 'Z' is not highlighted.
>
>   (let ((buf (generate-new-buffer "tmp")))
>     (switch-to-buffer buf)
>     (insert (propertize "XYZ" 'mouse-face 'region)))

This behaviour is still present in Emacs 28.

But I'm not sure what the correct behaviour would be.  Since mouse-face
has :extend, would it make sense to also extend it at eob?  Possibly...
not?

In any case, the current behaviour is a bug -- if it should extend at
eob, it should continue to do so even if the area has a newline, I
think.  (Or not extend at eob at all.)

This is just an issue with mouse-face, face doesn't have this problem:

  (let ((buf (generate-new-buffer "tmp")))
    (switch-to-buffer buf)
    (insert (propertize "XYZ" 'face 'region)))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no