Subject: bug#51550: 29.0.50; Customize Group INS buttons sometimes don't have a left box line

From: Stephen Berman <[email-masked]>
Date: Tue, 02 Nov 2021 11:58:16 +0100

On Tue, 02 Nov 2021 09:58:31 +0800 Po Lu <[email-masked]> wrote:

> Eli Zaretskii <[email-masked]> writes:
>
>> I see that xterm does something special in x_draw_relief_rect when the
>> line width is exactly 1 pixel, and w32term.c doesn't do that.  maybe
>> that's the problem.
>
> That isn't related, it only serves to make buttons look nicer and have
> more contrast by drawing a black line outside a relief rect.
>
> FWIW, this bug doesn't manifest in 27.2.

With the following patch I no longer see the display glitch:

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index fb06a95f51..ba6f26fccc 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -373,7 +373,7 @@ widget-specify-field
 	   (forward-char 1))
 	  (widget-field-add-space
 	   (insert-and-inherit " ")))
-    (setq to (point)))
+    (setq to (1- (point))))
   (let ((keymap (widget-get widget :keymap))
 	(face (or (widget-get widget :value-face) 'widget-field))
 	(help-echo (widget-get widget :help-echo))

However, this cannot be the right fix: with this patch the editable
field widget is no longer editable (it also doesnt't extended to the
right window margin, and it's one space shorter than when the
widget-field face is edited to remove the :extend property (without the
patch)).  Moreover, in emacs-27 the editable field is also extended yet
there's no display glitch.  (There's one difference in
widget-specify-field between emacs-27 and 28/master, but undoing that
change in the latter does not eliminate the display glitch.)

There's also something strange about customizing the widget-field face:
when I uncheck the box for "Extend" and click the "State" button to "Set
for Current Session", nothing happens with -Q and without -Q I get the
message "End of file during parsing".  If (without -Q) I click "State"
to "Save for Future Sessions", then it says "SAVED and set" but the
"Extend" checkbox remains checked and the editable fields are extended.
If I keep "Extend" checked and click the Value Menu to "Off", then I can
set the change for the current session, and then the editable field
widget is not extended, but the display glitch remains (and the editable
field is one space longer than with the above patch).

Steve Berman