changeset 7849:bbc7770db51c

(mouse-avoidance-point-position): Fix compute-motion call to use (X . Y) relative to window, not frame. Avoid errors if window-start < point-min.
author Richard M. Stallman <rms@gnu.org>
date Sat, 11 Jun 1994 12:14:28 +0000
parents 163a9c1b5394
children b6f3dd2511bc
files lisp/avoid.el
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/avoid.el	Sat Jun 11 12:12:57 1994 +0000
+++ b/lisp/avoid.el	Sat Jun 11 12:14:28 1994 +0000
@@ -109,18 +109,26 @@
   (let* ((w (selected-window))
 	 (edges (window-edges w))
 	 (list 
-	  (compute-motion (window-start w)                     ; start pos
-			  (cons (car edges) (car (cdr edges))) ; start XY
+	  (compute-motion (max (window-start w) (point-min))   ; start pos
+			  ;; window-start can be < point-min if the
+			  ;; latter has changed since the last redisplay 
+			  '(0 . 0)	                       ; start XY
 			  (point)	                       ; stop pos
-			  (cons (nth 2 edges) (nth 3 edges))   ; stop XY: none
+			  (cons (window-width) (window-height)); stop XY: none
 			  (1- (window-width))                  ; width
-			  (cons (window-hscroll w) 0) ; 0 may not be right?
+			  (cons (window-hscroll w) 0)          ; 0 may not be right?
 			  (selected-window))))
     ;; compute-motion returns (pos HPOS VPOS prevhpos contin)
     ;; we want:               (frame hpos . vpos)
-    (setcar list (selected-frame))	
-    (setcdr (cdr list) (car (cdr (cdr list))))
-    list))
+    (cons (selected-frame)
+	  (cons (+ (car edges)       (car (cdr list)))
+		(+ (car (cdr edges)) (car (cdr (cdr list))))))))
+
+;(defun mouse-avoidance-point-position-test ()
+;  (interactive)
+;  (message (format "point=%s mouse=%s" 
+;		   (cdr (mouse-avoidance-point-position))
+;		   (cdr (mouse-position)))))
 
 (defun mouse-avoidance-set-mouse-position (pos)
   ;; Carefully set mouse position to given position (X . Y)