emacs-diffs
[Top][All Lists]
Advanced

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

master 33602132ac: Handle text scale and global text scale during DND wh


From: Po Lu
Subject: master 33602132ac: Handle text scale and global text scale during DND wheel movement
Date: Sat, 23 Jul 2022 02:19:13 -0400 (EDT)

branch: master
commit 33602132acdf0ff9148aaeea32423c683529f039
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Handle text scale and global text scale during DND wheel movement
    
    * lisp/x-dnd.el (x-dnd-mwheel-scroll): Handle `text-scale' and
    `global-text-scale' mwheel actions.
---
 lisp/x-dnd.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index fa045d563c..ac78deaab6 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -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.



reply via email to

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