Subject: bug#40857: Invisibility specs do not apply to specified spaces

From: Eli Zaretskii <[email-masked]>
Date: Sun, 26 Apr 2020 18:20:55 +0300

> From: Clément Pit-Claudel <[email-masked]>
> Date: Sat, 25 Apr 2020 19:18:55 -0400
> 
> Consider the following program:
> 
> (with-current-buffer (get-buffer-create "*spaces*")
>   (erase-buffer)
>   (let ((indent (propertize " " 'display '(space :width 3))))
>     (put-text-property (point) (progn (insert indent "r1\n") (point)) 'invisible 'a)
>     (put-text-property (point) (progn (insert indent "r2\n") (point)) 'invisible 'b))
>   (add-to-invisibility-spec 'a)
>   (pop-to-buffer (current-buffer)))
> 
> The first record (r1) is hidden, but not the indentation that precedes it; so, instead of looking like this:
> 
>    r2
> 
> The buffer looks like this:
> 
>       r2

I don't think this is a bug.  A "replacing" display property in effect
forces the display engine to ignore the entire chunk of text "covered"
by that display property, so the fact that this chunk of text is in
this case invisible is never seen, nor acted upon.  Once the display
engine is done producing the stretch of white space for the display
property, it jumps to the end of the text "covered" by the property,
and continues from there.