Subject: Re: bug#69941: 30.0.50; Faulty fontification of radio button widgets

From: Stephen Berman <[email-masked]>
Date: Sun, 09 Feb 2025 12:04:01 +0100

On Sun, 9 Feb 2025 07:42:36 -0300 Mauro Aranda <[email-masked]> wrote:

> Stephen Berman <[email-masked]> writes:
>
>> On Sat, 8 Feb 2025 20:50:20 -0300 Mauro Aranda <[email-masked]>
>  wrote:
>>> So, modifying an inactive widget right at the start or at the end of the
>>> overlay can produce this effect.
>>>
>>> I don't think we can solve it easily like my patch did with the :from
>>> and :to markers, though.  But here's an idea:
>>>
>>> When a widget is already inactive (i.e., it has an :inactive property),
>>> instead of doing nothing we make sure to move the overlay so that it
>>> includes again all the widget, from the :from marker to the :to marker.
>>>
>>> If we do that, we should document that if some code modifies an
>>> :inactive widget, it has to call again :deactivate.
>>>
>>> I attach a patch with that idea, together with documentation changes and
>>> a new test.
>>
>> Thanks, I confirm this fixes the remaining misfontification. However,
>> if I switch the order of the last two lines above -- i.e, first
>> deactivate the radio widget and then set its value to the empty
>> string -- then I see the same misfontification of radio button "One"
>> that still occurs in emacs-30 (i.e. without both this patch and your
>> previous one).  Is this expected, and if so, can you explain why?
>>
>
> Isn't that what I described? I mean, if you first deactivate and then
> you change the value, you're modifying an already inactive widget, and
> now the documentation says that if you do that, you should make sure the
> :deactivate function runs again...

Right, thanks.  I was too eager to test your patch and just glanced at
your doc changes without really trying to understand them (or your
comments above).  Sorry, mea culpa.

> Without my patches, it's a 2-headed bug:
> 1) The :from marker doesn't include the 1st button anymore. That's the
> bug my first patch solved.
> 2) The :inactive overlay doesn't include the 1st button anymore. That's
> the bug my second patch tries to solve.

Thanks, this helps my understanding further.  (Nevertheless, much of the
Widget library remains a black box to me...)

Steve Berman