From 24d87be9a38f24ffdacc6df1e78f17b0b0a23e7f Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Wed, 26 Feb 2025 08:06:14 -0300 Subject: [PATCH] Avoid display bugs after editable-field widgets * lisp/wid-edit.el (widget-specify-button): Don't add an invisible space before the button to avoid bugs that surface with the widget-field face. The Widget library is not the one that puts a :box attribute for the button face, and we can't control what library users put after editable-field widgets. (widget-specify-field): Rather, add the invisible space here, after the newline. That way, we protect whatever comes after the editable-field widget. (Bug#51550) (cherry picked from commit 86dd455e9c7402737e2c0c45190fabbf1d3ee8c1) --- lisp/wid-edit.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index ef9ea8c0845..26764544532 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -427,7 +427,12 @@ the :notify function can't know the new value.") (overlay-put overlay 'local-map keymap) (overlay-put overlay 'face face) (overlay-put overlay 'follow-link follow-link) - (overlay-put overlay 'help-echo help-echo)) + (overlay-put overlay 'help-echo help-echo) + ;; Since the `widget-field' face has a :box attribute, we need to add + ;; some character with no face after the newline character, to avoid + ;; clashing with text that comes after the field and has a face with + ;; a :box attribute too. (Bug#51550) + (overlay-put overlay 'after-string #(" " 0 1 (invisible t)))) (setq to (1- to)) (setq rear-sticky t)) (let ((overlay (make-overlay from to nil nil rear-sticky))) @@ -468,8 +473,6 @@ the :notify function can't know the new value.") (widget-put widget :button-overlay overlay) (when (functionp help-echo) (setq help-echo 'widget-mouse-help)) - (overlay-put overlay 'before-string - (propertize " " 'invisible t 'face face)) (overlay-put overlay 'button widget) (overlay-put overlay 'keymap (widget-get widget :keymap)) (overlay-put overlay 'evaporate t) -- 2.39.5