> Eli Zaretskii writes: > > >> From: Po Lu > >> Cc: stefan@marxist.se,  stephen.berman@gmx.net, 51550@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 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.