emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 470d269ec1f 1/2: Make emoji-zoom-{increase, decrease} set text


From: Robert Pluim
Subject: emacs-29 470d269ec1f 1/2: Make emoji-zoom-{increase, decrease} set text properties correctly
Date: Thu, 6 Apr 2023 07:37:01 -0400 (EDT)

branch: emacs-29
commit 470d269ec1fe58935ff1b13e04d030ec40dcaa5e
Author: Robert Pluim <rpluim@gmail.com>
Commit: Robert Pluim <rpluim@gmail.com>

    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)
---
 lisp/international/emoji.el | 44 +++++++++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index bcd4aac4f29..ffff2aa1236 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -707,23 +707,33 @@ We prefer the earliest unique letter."
   "Increase the size of the character under point.
 FACTOR is the multiplication factor for the size."
   (interactive)
-  (set-transient-map emoji-zoom-map t nil "Zoom with %k")
-  (let* ((factor (or factor 1.1))
-         (old (get-text-property (point) 'face))
-         (height (or (and (consp old)
-                          (plist-get old :height))
-                     1.0))
-         (inhibit-read-only t))
-    (with-silent-modifications
-      (if (consp old)
-          (add-text-properties
-           (point) (1+ (point))
-           (list 'face (plist-put (copy-sequence old) :height (* height 
factor))
-                 'rear-nonsticky t))
-        (add-face-text-property (point) (1+ (point))
-                                (list :height (* height factor)))
-        (put-text-property (point) (1+ (point))
-                           'rear-nonsticky t)))))
+  (set-transient-map emoji-zoom-map t #'redisplay "Zoom with %k")
+  (unless (eobp)
+    (let* ((factor (or factor 1.1))
+           (old (get-text-property (point) 'face))
+           ;; The text property is either a named face, or a plist
+           ;; with :height, or a list starting with such a plist,
+           ;; 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))
+      (with-silent-modifications
+        (if (consp old)
+            (add-text-properties
+             (point) (1+ (point))
+             (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))
+          (add-face-text-property (point) (1+ (point))
+                                  (list :height newheight))
+          (put-text-property (point) (1+ (point))
+                             'rear-nonsticky t))))))
 
 ;;;###autoload
 (defun emoji-zoom-decrease ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]