Subject: Re: bug#76084: 31.0.50; Dragging tab line does not resize windows, unlike header line or mode line

From: martin rudalics <[email-masked]>
Date: Thu, 6 Feb 2025 10:01:39 +0100

> Dragging on empty space in the tab line does not resize windows.  This
 > is unlike the behavior when dragging on empty space in the mode line or
 > in the header line.

I attach a patch for this that hopefully does not negatively affect
'tab-line-mouse-move-tab'.  Juri will have to check.

 > Additionally, hovering the mouse pointer over empty space on the the
 > header line, while it does resize the window, does not display the
 > "resize up down" icon.  This behiavor is differnt from when you hover
 > the mouse pointer over the empty space on the mode line.

I suppose this will have to be done separately when specifying a header
line format (like, for example, 'ruler-mode' does).

martin

diff --git a/lisp/mouse.el b/lisp/mouse.el
index b05115b237d..499572862c9 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -844,7 +844,7 @@ mouse-drag-line
     ;; Decide on whether we are allowed to track at all and whose
     ;; window's edge we drag.
     (cond
-     ((eq line 'header)
+     ((memq line '(header tab))
       ;; Drag bottom edge of window above the header line.
       (setq window (window-in-direction 'above window t)))
      ((eq line 'mode))
@@ -906,7 +906,9 @@ mouse-drag-line
 		  ;; If necessary, add height of header line to `position'
 		  (when (memq (posn-area start)
 			      '(nil left-fringe right-fringe left-margin right-margin))
-		    (setq position (+ (window-header-line-height posn-window) position))))
+		    (setq position (+ (window-header-line-height posn-window)
+				      (window-tab-line-height posn-window)
+				      position))))
 		;; When the cursor overshoots after shrinking a window to its
 		;; minimum size and the dragging direction changes, have the
 		;; cursor first catch up with the window edge.
@@ -947,6 +949,7 @@ mouse-drag-line
 	       ;; with a mode-line, header-line or vertical-line prefix ...
 	       (define-key map [mode-line] map)
 	       (define-key map [header-line] map)
+	       (define-key map [tab-line] map)
 	       (define-key map [vertical-line] map)
 	       ;; ... and some maybe even with a right- or bottom-divider
 	       ;; or left- or right-margin prefix ...
@@ -1035,8 +1038,9 @@ mouse-drag-tab-line
   (interactive "e")
   (let* ((start (event-start start-event))
 	 (window (posn-window start)))
-    (when (and (window-live-p window)
-               (window-at-side-p window 'top))
+    (if (and (window-live-p window)
+             (not (window-at-side-p window 'top)))
+        (mouse-drag-line start-event 'tab)
       (let ((frame (window-frame window)))
         (when (frame-parameter frame 'drag-with-tab-line)
           (mouse-drag-frame-move start-event))))))