changeset 15476:0236199fc5f1

(mouse-drag-region): Be smart about which end gets point and which end gets the mark.
author Richard M. Stallman <rms@gnu.org>
date Fri, 21 Jun 1996 16:15:21 +0000
parents fc94c6fcee69
children eddac6796ebd
files lisp/mouse.el
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mouse.el	Fri Jun 21 15:33:46 1996 +0000
+++ b/lisp/mouse.el	Fri Jun 21 16:15:21 1996 +0000
@@ -574,9 +574,22 @@
 			(cons event unread-command-events)))
 	      (if (not (= (overlay-start mouse-drag-overlay)
 			  (overlay-end mouse-drag-overlay)))
-		  (let (last-command this-command)
-		    (push-mark (overlay-start mouse-drag-overlay) t t)
-		    (goto-char (overlay-end mouse-drag-overlay))
+		  (let* ((stop-point (posn-point (event-end event)))
+			 ;; The end that comes from where we ended the drag.
+			 ;; Point goes here.
+			 (region-termination
+			  (if (< stop-point start-point)
+			      (overlay-start mouse-drag-overlay)
+			    (overlay-end mouse-drag-overlay)))
+			 ;; The end that comes from where we started the drag.
+			 ;; Mark goes there.
+			 (region-commencement
+			  (- (+ (overlay-end mouse-drag-overlay)
+				(overlay-start mouse-drag-overlay))
+			     region-termination))
+			 last-command this-command)
+		    (push-mark region-commencement t t)
+		    (goto-char region-termination)
 		    (copy-region-as-kill (point) (mark t))
 		    (mouse-show-mark)
 		    (mouse-set-region-1))