Subject: Re: bug#79351: 30.2; window-resize-symbollwise

From: martin rudalics <[email-masked]>
Date: Tue, 2 Sep 2025 10:16:55 +0200

> Thanks a lot for the patch, feel free to let me know which version I could
 > build and test.

The patch I sent earlier had a thinko (the same as the one from 2014)
which I tried to fix now.  You should be able to apply the attached to
any recent version but I tested with master only.  You don't even have
to build Emacs, just compile and load mouse.el to test it.

Afterwards we'll have to decide whether we want this change to become
the default behavior (and obviously check whether it badly affects any
other instances of line dragging).  Note also, that "characterwise"
dragging does not take face remapping into account.  The size of a
character is always the canonical character size of the respective
frame.

martin

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 907a4883230..0b6ee318050 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -905,8 +905,12 @@ mouse-drag-line
 				 (> position (+ (window-pixel-left window)
 						(window-pixel-width window)))))
 		  (setq dragged t)
-		  (adjust-window-trailing-edge window growth t t))
-		(setq last-position position))
+		  (unless window-resize-pixelwise
+		    (setq growth (min (/ growth (frame-char-width frame)) 1)))
+		  (unless (zerop growth)
+		    (adjust-window-trailing-edge
+		     window growth t window-resize-pixelwise)
+		    (setq last-position position))))
 	       (t
 		;; Drag bottom edge of `window'.
 		(setq start (event-start event))
@@ -936,8 +940,12 @@ mouse-drag-line
 				 (> position (+ (window-pixel-top window)
 						(window-pixel-height window)))))
 		  (setq dragged t)
-		  (adjust-window-trailing-edge window growth nil t))
-		(setq last-position position)))))
+		  (unless window-resize-pixelwise
+		    (setq growth (min (/ growth (frame-char-height frame)) 1)))
+		  (unless (zerop growth)
+		    (adjust-window-trailing-edge
+		     window growth nil window-resize-pixelwise)
+		    (setq last-position position)))))))
            (old-track-mouse track-mouse))
       ;; Start tracking.  The special value 'dragging' signals the
       ;; display engine to freeze the mouse pointer shape for as long