From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69941: 30.0.50; Faulty fontification of radio button widgets Date: Thu, 09 May 2024 10:21:44 +0300 Message-ID: <861q6b8n7b.fsf@gnu.org> References: <87h6gynx49.fsf@rub.de> <865xxe1dwd.fsf@gnu.org> <51c20b56-4b82-4f5c-9559-cdbd0146df22@gmail.com> <87wmprqxj3.fsf@gmx.net> <8734s5w1mf.fsf@gmx.net> <941f6565-203b-47bf-82a9-2bb7b0788b6a@gmail.com> <86h6fyewgq.fsf@gnu.org> <875xwehjty.fsf@gmx.net> <87wmoqlcso.fsf@gmx.net> <87plucl2bh.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5331"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69941@debbugs.gnu.org, maurooaranda@gmail.com, monnier@iro.umontreal.ca To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 09 09:23:01 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s4y7I-0001KK-Mm for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 09 May 2024 09:23:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4y7A-0000ns-C4; Thu, 09 May 2024 03:22:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s4y6v-0000lE-4C for bug-gnu-emacs@gnu.org; Thu, 09 May 2024 03:22:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s4y6u-0007B6-GH for bug-gnu-emacs@gnu.org; Thu, 09 May 2024 03:22:36 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s4y7K-00077M-BC for bug-gnu-emacs@gnu.org; Thu, 09 May 2024 03:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 May 2024 07:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69941 X-GNU-PR-Package: emacs Original-Received: via spool by 69941-submit@debbugs.gnu.org id=B69941.171523934027352 (code B ref 69941); Thu, 09 May 2024 07:23:02 +0000 Original-Received: (at 69941) by debbugs.gnu.org; 9 May 2024 07:22:20 +0000 Original-Received: from localhost ([127.0.0.1]:53594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4y6d-000776-Ma for submit@debbugs.gnu.org; Thu, 09 May 2024 03:22:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4y6b-000770-Ia for 69941@debbugs.gnu.org; Thu, 09 May 2024 03:22:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s4y66-0006qI-5Z; Thu, 09 May 2024 03:21:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=5wDcDu3+Mcx9f5e/KrXtwAESpPqMX7T/O8Ihf+d2F0Q=; b=UPbEId32X0MVTvK5C7HJ LGvscj8yJtHIUSVkLPtQEim0uMuGLQFFhFk/zY3EhbGH/FsQLh+piiMSljzG83Y84UxsT+Gul/Hke tKEomFgrtq6+0Xpv96I8PJN5eov1t3w4RnFNGxTunL8WcMAgr6RCSN3nupaLQgoc7JDuK8SLAda9m pfvuh3HbWH+SBwSUSURvbLKqVfu0VYLKOifLLoEYZh+CiUK7BUeg+Dl2q8rnoKVMkJs3bg5grwON3 KT096LWPQnhTHDD3iIaaP/wax3XcrrxzPs15aLqDwFJMkcDgiHr8Klv/Ua5BP8mY/w76tCTF4U+Jf 4M9/dii6t1yxtA==; In-Reply-To: <87plucl2bh.fsf@gmx.net> (message from Stephen Berman on Fri, 26 Apr 2024 14:45:54 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284726 Archived-At: Ping! Any comments? Or should we install the proposed patch? > From: Stephen Berman > Cc: Mauro Aranda , 69941@debbugs.gnu.org, > monnier@iro.umontreal.ca > Date: Fri, 26 Apr 2024 14:45:54 +0200 > > On Sun, 21 Apr 2024 21:45:59 +0200 Stephen Berman wrote: > > > On Thu, 18 Apr 2024 15:38:33 +0200 Stephen Berman wrote: > > > >> On Thu, 18 Apr 2024 14:33:57 +0300 Eli Zaretskii wrote: > >> > >>>> Date: Thu, 18 Apr 2024 07:18:29 -0300 > >>>> Cc: Eli Zaretskii , 69941@debbugs.gnu.org, > >>>> Stefan Monnier > >>>> From: Mauro Aranda > >>>> > >>>> > To fix this bug, do you have a preference between this patch for > >>>> > widget-specify-inactive and the attached patch for > >>>> > widget-default-create?  Or do you have a better fix? > >>>> > > >>>> > Steve Berman > >>>> > >>>> I don't really have a better fix.  I mean, ideally, we'd find the reason > >>>> why the setting behaves differently for the radio-button-choice widget, > >>>> and only for the first one in a radio widget, as it seems to me. But > >>>> I'll need more time to be able to look into that. > >>>> > >>>> That said, if Eli is OK with installing a minor hack (with a FIXME, > >>>> please), I don't have problems.  And since it's a hack (and hopefully > >>>> temporary), it's better if we keep it at widget-default-create then. > >>> > >>> My opinion doesn't matter much in this case. If you two agree on a > >>> solution, feel free to install it, even if it is not 110% clean. > >> > >> I've been using the patch for for widget-specify-inactive in an > >> application I'm developing that exercises radio-button-choice widgets, > >> but I'll switch to using the patch for widget-default-create instead. > >> I've been encountering inconsistent behavior in combination with the use > >> of widget-unselected face that I haven't tracked down the cause of yet. > >> I don't expect using the patch for widget-default-create will improve > >> this issue, but I'll find out. I also plan to test that patch in > >> combination with widget-unselected face with checklist widgets, which my > >> application currently does not use. I'll report back here before > >> committing the patch for widget-default-create (or something else, > >> depending on the outcome of further testing). > > > > Just a brief status report: My testing does indeed indicate that the > > fontification problem with radio-button-choice also occurs with > > checklist widgets, though the pattern appears not to be identical; I > > need to do more testing and debugging. > > Further testing confirms that checklists are subject to this problem, so > I've added them to the attached patch. The rest of this post reports > results from and speculations based on my debugging efforts, which > remain somewhat inconclusive. > > According to my tests, checklists and radio-button-choice widgets do > indeed display the same problem with the first checkbox or radio-button, > respectively: if it's selected and then the parent widget is > deactivated, then the button/checkbox incorrectly does not have > widget-inactive face. I think the reason for this is that selecting > inserts "[X]" for the checkbox and "(*)" for the radio-button, and since > the parent widget's :from property has marker insertion type `t', its > position advances to after the insertion (I guess this is because the > starting position of the first checkbox/button coincides with the parent > widget's :from), so the overlay with the widget-inactive face beginning > at :from does not cover the checkbox/button. > > But checklists and radio-button-choice widgets differ when a non-initial > checkbox/button is selected. With checklists, multiple checkboxes can > be selected, and selecting the second checkbox does not advance the > parent widget's :from position, unlike with radio-button-choice widget's > when selecting the second radio-button, as I reported in my OP. I think > this is because in radio-button-choice widgets only one radio-button can > be selected, so selecting any one triggers the :from marker's advancing. > I could not verify this hypothesis through debugging because I was > unable to find out exactly when this happens. The marker advance is > done in the C code, I think at adjust_markers_for_insert in insdel.c; I > set a gdb breakpoint there and this triggers when I select a radio > button, but it's too early: a lot happens in wid-edit.el between > selecting a button and the selection becoming visible, and the > breakpoint triggered so often that I gave up. Is there a way to make a > breakpoint in the C code trigger only when a specific part of > wid-edit.el is evaluated? > > Nevertheless, by assigning the :from marker the insertion type nil in > widget-default-create when the widget is either a checklist or > radio-button-choice, does result in the correct fontification of the > first checkbox/radio-button in all tests I've conducted with varying the > selection. And conceptually it seems to me correct that :from should > not advance with these widgets: selecting a checkbox or button is > operationally quite different from inserting text (e.g. in an > editable-field widget), even though the implementation technically > involves insertion. So I think the attached patch is at least a viable > stopgap, until a better (or at least less ad hoc) fix is found. > > Steve Berman