bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces


From: Robert Pluim
Subject: bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces
Date: Wed, 05 Apr 2023 13:55:22 +0200

>>>>> On Wed, 05 Apr 2023 12:54:27 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Cc: 62675@debbugs.gnu.org
    >> Date: Wed, 05 Apr 2023 11:12:31 +0200
    >> 
    Eli> Please do, and thanks.  We don't need to understand why some bug seems
    Eli> to work, it is enough to fix the bug.
    >> 
    >> This seems to work:

    Eli> Looks reasonable, thanks.  Please try both with font-lock-mode ON and
    Eli> OFF, and in the latter case both with some non-default face at point
    Eli> and without.

Ah yes, font-lock off makes it all more complex. Tested in those 3
cases. Is this too much for emacs-29?

diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index bcd4aac4f29..ff55170875e 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -708,22 +708,32 @@ emoji-zoom-increase
 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)))))
+  (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 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 ()

Robert
-- 





reply via email to

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