]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid display bugs after editable-field widgets
authorMauro Aranda <maurooaranda@gmail.com>
Wed, 26 Feb 2025 11:06:14 +0000 (08:06 -0300)
committerEshel Yaron <me@eshelyaron.com>
Fri, 28 Feb 2025 11:17:10 +0000 (12:17 +0100)
* 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

index ef9ea8c0845a0f957270d715fae8b05ee401d84e..26764544532dc6d50e4cdca55e9b8bf9c3f0931a 100644 (file)
@@ -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)