Make emoji-zoom-{increase,decrease} set text properties correctly

* lisp/international/emoji.el (emoji-zoom-increase): Ensure that we're
increasing the :height of the anonymous face at point, rather than
having two :height properties, which appeared to work by
accident, and don't error at eob.  (Bug#62675)
This commit is contained in:
Robert Pluim 2023-04-05 15:19:13 +02:00
parent 63d4a86f8d
commit 470d269ec1

View file

@ -707,23 +707,33 @@ We prefer the earliest unique letter."
"Increase the size of the character under point. "Increase the size of the character under point.
FACTOR is the multiplication factor for the size." FACTOR is the multiplication factor for the size."
(interactive) (interactive)
(set-transient-map emoji-zoom-map t nil "Zoom with %k") (set-transient-map emoji-zoom-map t #'redisplay "Zoom with %k")
(unless (eobp)
(let* ((factor (or factor 1.1)) (let* ((factor (or factor 1.1))
(old (get-text-property (point) 'face)) (old (get-text-property (point) 'face))
(height (or (and (consp old) ;; The text property is either a named face, or a plist
(plist-get old :height)) ;; with :height, or a list starting with such a plist,
1.0)) ;; followed by one or more faces.
(newheight (* (or (and (consp old)
(or (plist-get (car old) :height)
(plist-get old :height)))
1.0)
factor))
(inhibit-read-only t)) (inhibit-read-only t))
(with-silent-modifications (with-silent-modifications
(if (consp old) (if (consp old)
(add-text-properties (add-text-properties
(point) (1+ (point)) (point) (1+ (point))
(list 'face (plist-put (copy-sequence old) :height (* height factor)) (list 'face
(if (eq (car old) :height)
(plist-put (copy-sequence old) :height newheight)
(cons (plist-put (car old) :height newheight)
(cdr old)))
'rear-nonsticky t)) 'rear-nonsticky t))
(add-face-text-property (point) (1+ (point)) (add-face-text-property (point) (1+ (point))
(list :height (* height factor))) (list :height newheight))
(put-text-property (point) (1+ (point)) (put-text-property (point) (1+ (point))
'rear-nonsticky t))))) 'rear-nonsticky t))))))
;;;###autoload ;;;###autoload
(defun emoji-zoom-decrease () (defun emoji-zoom-decrease ()