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

From: Noam Postavsky <[email-masked]>
Date: Sun, 5 Jun 2016 15:13:00 -0400

On Sun, Jun 5, 2016 at 1:56 PM, Eli Zaretskii <[email-masked]> wrote:
>> From: Noam Postavsky <[email-masked]>
>> Date: Sun, 5 Jun 2016 13:05:53 -0400
>> Cc: John Mastro <[email-masked]>, [email-masked], [email-masked]
>>
>> On Sun, Jun 5, 2016 at 11:54 AM, Eli Zaretskii <[email-masked]> wrote:
>> > We always try to make the empty space
>> > after the end of a screen line have the same face as the last
>> > character of that line.
>>
>> Just to clarify, "last character of that line" refers to the newline
>> character or the one before it?
>
> The last displayed character of the line.  The newline is not
> displayed, in the sense that it has no glyph, so it can have no face.

That doesn't seem to be the case, with the following modification to
the recipe so that the newline characters are not underlined, the
underlining does not continue to the edge of the screen:

(let (beg end ov)
  (defface example-underline-face
    '((t :underline t))
    "Example face with underlining")
  (goto-char (point-max))
  (newline)
  (setq beg (point))
  (insert "    foo")
  (setq end (point))
  (setq ov (make-overlay beg end))
  (overlay-put ov 'face 'example-underline-face)
  (insert "\n")
  (setq beg (point))
  (insert "    bar")
  (setq end (point))
  (setq ov (make-overlay beg end))
  (overlay-put ov 'face 'example-underline-face)
  (insert "\n"))

>
>> > While it should be
>> > possible to have GUI frames display underline all the way to window
>> > edge, no one has ever requested that, so we didn't bother.
>>
>> I think this would have been useful for magit to simplify the use of
>> overlays to display the region with horizontal lines.
>
> This is doable (and in fact we already do that in R2L paragraphs,
> which you can observe if you change the recipe's text to use R2L
> characters).

Yes (though it seems R2L is disabled in programming modes by default,
needed to use fundamental-mode buffer to see the effect).

>> In http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21468#43 you
>> suggested a way using :align-to which turned out to have a bunch of
>> complications and magit ended up not using it (see
>> https://github.com/magit/magit/pull/2293).
>
> Did you try using the box attribute of a face?

Yes, but magit actually wants a multiline box (without internal
lines), so it didn't really work out (anyway, this is getting
off-topic for this bug).