Subject: Re: bug#78184: 30.0.93; ansi-osc-apply-on-region should use end marker

From: Troy Brown <[email-masked]>
Date: Mon, 12 May 2025 18:32:13 -0400

On Sat, May 10, 2025 at 6:52 AM Eli Zaretskii <[email-masked]> wrote:
>
> > From: Matthias Meulien <[email-masked]>
> > Date: Thu, 8 May 2025 17:12:50 +0200
> > Cc: Troy Brown <[email-masked]>, [email-masked]
> >
> > Troy analysis is right.  I was able to reproduce.  Please have a look to the attached patch.
>
> Thanks.  Troy, could you please try the patch and report?

Yes, I can confirm that this patch addresses the issue I'm seeing.  It
appears the patch was for the master branch, so that is where I
applied and tested it.  I assume this change would also be merged into
the Emacs 30 branch.

I did have a couple notes.  I believe an end marker should also be
used in `ansi-osc-filter-region` to honor the original bounds passed
into the function, since it also calls `delete-region`.  I'm not aware
of it raising an error due to its absence, but I believe it would be
correct to use it, and would also match `ansi-color-filter-region`.
Also, it seems `ansi-osc-filter-region` doesn't handle "fragments"
(where only the beginning of the escape sequence appears in the
supplied range), by saving and reusing context, whereas the
corresponding `ansi-color-filter-region` does.  Therefore if an OSC
control sequence overlapped the supplied bounds, I don't think it
would be filtered out on the next call to `ansi-osc-filter-region`.