]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle text scale and global text scale during DND wheel movement
authorPo Lu <luangruo@yahoo.com>
Sat, 23 Jul 2022 06:18:18 +0000 (14:18 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 23 Jul 2022 06:19:03 +0000 (14:19 +0800)
* lisp/x-dnd.el (x-dnd-mwheel-scroll): Handle `text-scale' and
`global-text-scale' mwheel actions.

lisp/x-dnd.el

index fa045d563c34299b42a1a928493e50cd8403930f..ac78deaab606a99d6f07d4ae7bc5dcab47531f1f 100644 (file)
@@ -778,7 +778,11 @@ has been pressed."
                   (* 1 count))))
     (unless (and (not mouse-wheel-tilt-scroll)
                  (or (eq button 6) (eq button 7)))
-      (let ((function (cond ((eq button 4)
+      (let ((function (cond ((eq type 'text-scale)
+                             #'text-scale-adjust)
+                            ((eq type 'global-text-scale)
+                             #'global-text-scale-adjust)
+                            ((eq button 4)
                              (if hscroll
                                  mwheel-scroll-right-function
                                mwheel-scroll-down-function))
@@ -794,9 +798,17 @@ has been pressed."
                              (if mouse-wheel-flip-direction
                                  mwheel-scroll-left-function
                                mwheel-scroll-right-function)))))
+        ;; Button5 should decrease the text scale, not increase it.
+        (when (and (memq type '(text-scale global-text-scale))
+                   (eq button 5))
+          (setq amt (- amt)))
         (when function
           (condition-case nil
-              (funcall function amt)
+              ;; Don't overwrite any echo-area message that might
+              ;; already be shown, since this can be called from
+              ;; `x-begin-drag'.
+              (let ((inhibit-message t))
+                (funcall function amt))
             ;; Do not error at buffer limits.  Show a message instead.
             ;; This is especially important here because signalling an
             ;; error will mess up the drag-and-drop operation.