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

From: Stephen Berman <[email-masked]>
Date: Mon, 13 May 2024 15:53:54 +0200

On Mon, 13 May 2024 09:28:54 -0400 Stefan Monnier <[email-masked]> wrote:

>>> I meant the "too late" insertion of radio buttons into
>>> radio-button-choice widgets (and likewise of checkboxes into checklist
>>> widgets), because IIUC the way this is currently done (by
>>> widget-radio-add-item and widget-checklist-add-item, respectively)
>>> requires that the container widget is already in the buffer.
>>
>> Then maybe widgets which expect to be filled after they're created
>> should make sure they have an additional character at the beginning and
>> another at the end so insertions "inside" don't get confused from
>> insertions "right before" or "right after".

Something like with editable-field widgets (cf. commit 3bff434b8:
"Document need to put some text before the %v escape in :format
string")?  Wouldn't that complicate the display these widgets,
e.g. forcing a corresponding offset of all radio buttons or checkboxes
in order to align with the first one?

> Or maybe `widget-*-add-item` should temporarily change the insertion
> type of the from/to markers?

What do you mean by "temporarily"?  Recall the problem that prompted my
OP in this bug is the misfontification of the first radio button in a
deactivated radio-button-choice widget, and the deactivation can happen
any time, long after the widget and its children haven been created.

Maybe it could be left up to the deactivation code to ensure that the
radio-button-choice widget's :from and the :from of its first child
coincide when deactivation (and accompanying fontification) occurs, and
then reset the previous values afterwards.  Though that seems pretty ad
hoc... (and would resetting the :from affect the fontification?)

Steve Berman