aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2006-06-19 21:47:23 +0000
committerRichard M. Stallman <[email protected]>2006-06-19 21:47:23 +0000
commit73c8f64c94e2fbac653615eaade01028c2d7bce7 (patch)
tree00a508539d4ead0718f5018acb12978495004fa3 /lisp/mouse.el
parent161c71277e2a6d894989fd72e6381c76f46d9760 (diff)
(mouse-drag-vertical-line-rightward-window): New function.
(mouse-drag-vertical-line): Call it.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el21
1 files changed, 20 insertions, 1 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index c399515a3d..145eb76446 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -529,6 +529,24 @@ resized by dragging their header-line."
(mouse-drag-mode-line-1 start-event nil))))
+(defun mouse-drag-vertical-line-rightward-window (window)
+ "Return a window that is immediately to the right of WINDOW, or nil."
+ (let ((bottom (nth 3 (window-inside-edges window)))
+ (left (nth 0 (window-inside-edges window)))
+ best best-right
+ (try (previous-window window)))
+ (while (not (eq try window))
+ (let ((try-top (nth 1 (window-inside-edges try)))
+ (try-bottom (nth 3 (window-inside-edges try)))
+ (try-right (nth 2 (window-inside-edges try))))
+ (if (and (< try-top bottom)
+ (>= try-bottom bottom)
+ (< try-right left)
+ (or (null best-right) (> try-right best-right)))
+ (setq best-right try-right best try)))
+ (setq try (previous-window try)))
+ best))
+
(defun mouse-drag-vertical-line (start-event)
"Change the width of a window by dragging on the vertical line."
(interactive "e")
@@ -594,7 +612,8 @@ resized by dragging their header-line."
;; adjust the window on the left.
(if (eq which-side 'right)
(selected-window)
- (previous-window))))
+ (mouse-drag-vertical-line-rightward-window
+ (selected-window)))))
(setq x (- (car (cdr mouse))
(if (eq which-side 'right) 0 2))
edges (window-edges window)