Don't unconditionally append the :ascent property in wid-edit

* lisp/wid-edit.el (widget-toggle-value-create): Don't
duplicate the :ascent property if already set.  (Bug#81167)
This commit is contained in:
David Ponce 2026-06-01 11:35:15 +02:00 committed by Eli Zaretskii
parent d852d36c77
commit e6e79b1e09

View file

@ -2546,9 +2546,13 @@ when he invoked the menu."
(widget-get widget (if val :on :off))))
(img (widget-image-find
(widget-get widget (if val :on-glyph :off-glyph)))))
(widget-image-insert widget (or text "")
(if img
(append img '(:ascent center))))))
(and img (null (image-property img :ascent))
;; Unlike (setf (image-property img :ascent) 'center), a simple
;; `append' will not modify img as a side effect, and is safe
;; to use here because the :ascent property is guaranteed to be
;; absent.
(setq img (append img '(:ascent center))))
(widget-image-insert widget (or text "") img)))
(defun widget-toggle-action (widget &optional event)
;; Toggle value.