Subject: Re: bug#70236: Truncating only happening on 900 character long lines in *compilation* buffer

From: Phil Sainty <[email-masked]>
Date: Sat, 13 Apr 2024 23:06:32 +1200

On 2024-04-13 21:06, Eli Zaretskii wrote:
> No further comments, so I presume the bug is indeed fixed,
> and I'm therefore closing it.

Thanks Eli.  I presumed Dan would have tested, but I've just
given that a whirl and it looks like there's an off-by-one
bug in the fix.

Apart from the "900" line (which seems to remain special for
whatever reason the truncation was working there in the first
place), all the lines > 400 chars are getting two buttons:
one with the ellipsis, followed by a second button which is
"hiding" only the final character in the line (but also using
that character as the button text, so it's not "hidden", and
selecting that button just has the effect of that character
no longer looking like a button.

So in that test file the end of the lines looks like "[…]]"
but the two "]" chars are not related -- it's just that "]"
is the last character of each long line in that test file.

Selecting the […] button eliminates both buttons, but
selecting the "final character" button only eliminates that
button (as in both cases the button callback acts through to
the `line-end-position'.

I *think* commenting out this addition is the solution?
You'd already called `backward-char' earlier, so it looks
like this was doubling-up on that.

           (put-text-property
            start ;; (if ends-in-nl
                  ;;     ;; Don't hide the final newline.
                  ;;     (1- (point))
                    (point);; )
            'display (if (char-displayable-p ?…) "[…]" "[...]"))

-Phil