GNU bug report logs - #51550
29.0.50; Customize Group INS buttons sometimes don't have a left box line

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Mon, 1 Nov 2021 13:53:02 UTC

Severity: minor

Found in version 29.0.50

Fixed in version 31.1

Done: Mauro Aranda <maurooaranda <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #105 received at 51550 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: 51550 <at> debbugs.gnu.org, Po Lu <luangruo <at> yahoo.com>,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#51550: 29.0.50; Customize Group INS buttons sometimes don't
 have a left box line
Date: Thu, 16 Jan 2025 18:54:45 -0300
[Message part 1 (text/plain, inline)]
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> From: Po Lu <luangruo <at> yahoo.com>
> >> Cc: stefan <at> marxist.se,  stephen.berman <at> gmx.net, 51550 <at> debbugs.gnu.org
> >> Date: Wed, 29 Dec 2021 21:54:38 +0800
> >>
> >>   (with-current-buffer (get-buffer-create "*test*")
> >>     (insert #("foo\nfoo" 0 4 (face widget-field)))
> >>     (let ((overlay (make-overlay 5 8 nil t nil)))
> >>       (overlay-put overlay 'before-string (propertize " " 
'invisible t))
> >>       (overlay-put overlay 'face custom-button)))
> >>
> >> After this, I would have expected the second "foo" in *test* to begin
> >> with a box line, but it doesn't.
> >
> > It was a subtle bug in how we handle face's box attribute when the
> > display engine changes the object on which it iterates.  Compare the
> > effect of this:
> >
> >   (with-current-buffer (get-buffer-create "*test*")
> >     (load "wid-edit")
> >     (load "cus-edit")
> >     (insert #("foo\nfoo" 0 4 (face widget-field)))
> >     (let ((overlay (make-overlay 5 8 nil t nil)))
> >       (overlay-put overlay 'before-string "X")
> >       (overlay-put overlay 'face custom-button)))
> >
> > with this:
> >
> >   (with-current-buffer (get-buffer-create "*test*")
> >     (load "wid-edit")
> >     (load "cus-edit")
> >     (insert #("foo\nXfoo" 0 4 (face widget-field)))
> >     (let ((overlay (make-overlay 6 9 nil t nil)))
> >       (overlay-put overlay 'face custom-button)))
> >
> > The change of face between the "X" and the following button should be
> > displayed the same, but wasn't.
> >
> > I installed a fix on master.  Please see if it solves the real-life
> > use case, and close the bug if it does.
>
> Yes, that fixes the problem.  I'll push the corresponding fix to the
> custom widget code, and I'm closing this bug.  Thanks.

I've reopened this bug, since the fix caused another bug (Bug#73911),
and the fix for that bug (which made sense to me) caused this one to
reappear.

I'll try to summarize things as I understand them.  Please correct me if
I'm wrong:

The change that made visible the bug is:

commit 8b024a6ff10f7907445ea60c4db8355638616ed1
Author: Stefan Kangas <stefan <at> marxist.se>
Date:   Mon Mar 15 00:27:20 2021 +0100

    * lisp/wid-edit.el (widget-field): Add subtle border to face.

 lisp/wid-edit.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

The added :box attribute to the widget-field face makes it collide with
the :box attribute of the custom-button face somehow, and it results in
buttons that follow an editable-field widget that happen to end with a
newline character, being displayed without a left box line.

The discussion was about whether it was a bug in the display code or in
the way the faces and overlays get set in the Customize buffer, and
first Eli suggested to add an invisible space before the buttons,
outside any overlay.  I understand this is a workaround, but could be
the way to fix the bug indeed.

Adding the invisible space inside the button overlay seemed to work,
although it led to Bug#73911.  So it's not the right fix, I think.


Now, I think one way to fix this (assuming we're sure we want the
:box attribute for the widget-field face) is not by changing the widgets
(or whatever content) that come after the editable-field widget, since
that's something we can't control in the Widget library. Instead,
the focus should be in the editable-field.  I attach a patch to show
what I'm thinking about, but I need to test it more.

[0001-Avoid-display-bugs-after-editable-field-widgets.patch (text/x-patch, attachment)]

This bug report was last modified 81 days ago.

Previous Next


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