GNU bug report logs - #69941
30.0.50; Faulty fontification of radio button widgets

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Fri, 22 Mar 2024 15:01:01 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #130 received at 69941-done <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 69941-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#69941: 30.0.50; Faulty fontification of radio button widgets
Date: Sat, 08 Feb 2025 14:20:48 +0100
[Message part 1 (text/plain, inline)]
On Thu, 6 Feb 2025 19:54:02 -0300 Mauro Aranda <maurooaranda <at> gmail.com> wrote:

> Stephen Berman <stephen.berman <at> gmx.net> writes:
>
>> On Thu, 6 Feb 2025 11:19:53 -0300 Mauro Aranda <maurooaranda <at> gmail.com>
>  wrote:
>>
>>> Stephen Berman <stephen.berman <at> gmx.net> writes:
>>>
>>>> On Wed, 05 Feb 2025 15:10:16 +0200 Eli Zaretskii <eliz <at> gnu.org> wrote:
>>>>
>>>>>> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
>>>>>> Cc: Mauro Aranda <maurooaranda <at> gmail.com>,  stephen.berman <at> gmx.net,
>>>>>>   69941 <at> debbugs.gnu.org
>>>>>> Date: Sun, 02 Feb 2025 18:28:39 -0500
>>>>>>
>>>>>> > Stefan, any further comments, or should we install this?
>>>>>>
>>>>>> We can install this, AFAIC.
>>>>>
>>>>> Thanks, installed on the master branch, and closing the bug.
>>>>
>>>> I've only now found time to try Mauro's patch, and while I can confirm
>>>> that it fixes the example of misfontification I reported in my OP,
>>>> unfortunately I still see the same kind of misfontification with the
>>>> program of mine that prompted my OP.  I haven't had time to investigate
>>>> further and I'm not sure when I will, but if and when I can provide more
>>>> information, I'll either reopen this bug or file a new one.
>>>>
>>>> Steve Berman
>>>
>>> Can you share some code? Either here or by private email?
>>
>> Rather than posting or sending you the whole program as well as a data
>> file needed to run it and explaining how to use it, I'd prefer to try
>> and isolate the problem and provide a small and self-contained code
>> snippet to reproduce it.  I'll try to do that in the next few days.
>>
>> Steve Berman
>
> Ok then, I'll wait.

With the attached file I can reproduce the problem.  Save the file and
then invoke Emacs from master (i.e., with your patch) as follows:

emacs -Q -l srb-widget-test.el -f srb-widget-test

In the displayed buffer "*Widget Test*" the three radio buttons "One",
"Two" and "Confirm" are active, which the default face visually
confirms.  (Their labels are fontified with face `widget-unselected'.)
Now do the following steps:

1. Hit TAB to move point to radio button "One".
2. Type RET to activate the "Reset" button and move point to it.  Also,
   the radio buttons are now deactivated, which is indicated by their
   now being fontified with face `widget-inactive' (as are their
   labels).
3. Type RET on the "Reset" button to reactivate the radio buttons.
4. Hit TAB twice to move point to radio button "Two".  Hitting RET
   results in the same state as in step 2.
5. Repeat step 3 and then hit TAB three times (or S-TAB once) to move
   point to radio button "Confirm".  This pops up two indented radio
   buttons "Right" and "Wrong" under "Confirm", and point is now on
   "Right".  Note that the radio buttons "One", "Two" and "Confirm" are
   deactivated, while "Right" and "Wrong" are active.
6. Type RET on radio button "Right".  This deletes radio buttons "Right"
   and "Wrong" and moves point to "Reset".  Radio buttons "One", "Two"
   and "Confirm" remain deactivated (confirmed by tabbing to each and
   typing RET, which dings and displays the message "Attempt to perform
   action on inactive widget"); however:
=> Now radio button "One" is misfontified with the default face instead
   of face `widget-inactive'.

If you repeat step 5 and then tab to radio button "Wrong" and hit RET,
the resulting state is the same as in step 6, i.e., radio button "One"
(and only it) is again misfontified.

Note that if you load the file and execute the recipe in emacs-30, the
misfontification of radio button "One" also happens on steps 2, 4 and 5.
So the correct fontification on these steps in master is due to your
patch.  But the patch doesn't prevent the misfontification in step 6.
However, I have found two ways to avoid this misfontification: One way
is to uncomment the line `(widget-apply srb--radio-widget :activate)' in
`srb--confirm', the other way is to comment out the line
`(widget-value-set srb--radio-widget "")' in `srb--result'.

The second "workaround" (i.e., not using an emtpy value for the radio
button widget) may be regarded as the "proper" way to use radio buttons,
since it visually distinguishes the selected button from the unselected
ones.  But the empty string is a valid value, and there may be aesthetic
or other reasons for using it (one in this case is that the code to move
point to the "Reset" button doesn't work as intended on hitting the
child radio buttons, though that is probably not hard to fix).

I briefly tried to find the cause of the misfontification by stepping
through `widget-radio-value-set', but this seems to require a more
detailed examination of the widget properties than I currently have time
for, or perhaps just a better understanding of the widget code than I
have.

Steve Berman
[srb-widget-test.el (application/emacs-lisp, attachment)]

This bug report was last modified 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.