diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-06-21 16:15:21 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-06-21 16:15:21 +0000 |
commit | 6ce29929455abeedc127bb1cbcd3b1baefca0d0e (patch) | |
tree | 67415ebd344b0c0ec555f00cf58de06f72da2373 /lisp/mouse.el | |
parent | bca55f26b253f3372e0565235431898340933d8f (diff) | |
download | emacs-6ce29929455abeedc127bb1cbcd3b1baefca0d0e.tar.gz |
(mouse-drag-region): Be smart about which end
gets point and which end gets the mark.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r-- | lisp/mouse.el | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index bd4e439b21e..41fda55689b 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -574,9 +574,22 @@ remains active. Otherwise, it remains until the next input event." (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)) |