Subject: Re: bug#65896: 30.0.50; folding text with text properties prevents background from extending past the newline

From: Ihor Radchenko <[email-masked]>
Date: Sat, 23 Sep 2023 12:59:32 +0000

Eli Zaretskii <[email-masked]> writes:

>> 1. emacs -Q
> ...
> It's because the invisible text does not include the newline of the
> #+end_src line, and that newline has the face you don't want to see.
>
> If we ignore the face of the newline itself, we will change the
> behavior when the last glyph before the newline has a different face.
> The most notable use case is:
>
>   . C-e
>   . C-SPC
>   . C-f
>
> This is expected to paint with the region face the part between the
> last glyph of the current line and the first glyph of the next line,
> but with your proposal will not.  IOW, the region face will
> effectively not be extended in this case.

I see. Note that there is a similar case when the region is not
displayed at all:

* Folded heading<point>...

. C-SPC
. C-f
(observe ellipsis not being highlighted)

> Why cannot Org include in the invisible text the newline of the last
> line that is being hidden?  That is, in the above scenario, make the
> invisible text begin with the first character of "#+begin_src" and end
> after the newline following "#+end_src".

That will make ellipsis displayed on the same line with the next heading:

* Heading
...* Another heading

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>