]> code.delx.au - gnu-emacs/commitdiff
(mouse-drag-window-above): Verify that the found window overlaps with the
authorEli Zaretskii <eliz@gnu.org>
Sat, 31 Dec 2005 11:47:05 +0000 (11:47 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 31 Dec 2005 11:47:05 +0000 (11:47 +0000)
given window in the horizontal dimension.

lisp/ChangeLog
lisp/mouse.el

index e56815a04f07fd6799cd8f0448b8fbc0794bfb69..156c863e8b4ce3b4464e8945d0805b81dbeb3552 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-31  Lennart Borgman  <lennart.borgman.073@student.lu.se>  (tiny change)
+
+       * mouse.el (mouse-drag-window-above): Verify that the found window
+       overlaps with the given window in the horizontal dimension.
+
 2005-12-31  Eli Zaretskii  <eliz@gnu.org>
 
        * Makefile.in (cvs-update): New target.
index 186fa438b35256b7e7ff86b20cfe0473d0f86c32..8f0fedf401e803bf5b64aa4a3d9cb386776d9f07 100644 (file)
@@ -355,14 +355,21 @@ This command must be bound to a mouse click."
 (defun mouse-drag-window-above (window)
   "Return the (or a) window directly above WINDOW.
 That means one whose bottom edge is at the same height as WINDOW's top edge."
-  (let ((top (nth 1 (window-edges window)))
+  (let ((start-top   (nth 1 (window-edges window)))
+        (start-left  (nth 0 (window-edges window)))
+        (start-right (nth 2 (window-edges window)))
        (start-window window)
        above-window)
     (setq window (previous-window window 0))
     (while (and (not above-window) (not (eq window start-window)))
-      (if (= (+ (window-height window) (nth 1 (window-edges window)))
-            top)
-         (setq above-window window))
+      (let ((left  (nth 0 (window-edges window)))
+            (right (nth 2 (window-edges window))))
+        (when (and (= (+ (window-height window) (nth 1 (window-edges window)))
+                      start-top)
+                   (or (and (<= left start-left)  (<= start-right right))
+                       (and (<= start-left left)  (<= left start-right))
+                       (and (<= start-left right) (<= right start-right))))
+          (setq above-window window)))
       (setq window (previous-window window)))
     above-window))