diff options
| author | Richard M. Stallman | 1996-06-21 16:15:21 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-06-21 16:15:21 +0000 |
| commit | 6ce29929455abeedc127bb1cbcd3b1baefca0d0e (patch) | |
| tree | 67415ebd344b0c0ec555f00cf58de06f72da2373 | |
| parent | bca55f26b253f3372e0565235431898340933d8f (diff) | |
| download | emacs-6ce29929455abeedc127bb1cbcd3b1baefca0d0e.tar.gz emacs-6ce29929455abeedc127bb1cbcd3b1baefca0d0e.zip | |
(mouse-drag-region): Be smart about which end
gets point and which end gets the mark.
| -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." | |||
| 574 | (cons event unread-command-events))) | 574 | (cons event unread-command-events))) |
| 575 | (if (not (= (overlay-start mouse-drag-overlay) | 575 | (if (not (= (overlay-start mouse-drag-overlay) |
| 576 | (overlay-end mouse-drag-overlay))) | 576 | (overlay-end mouse-drag-overlay))) |
| 577 | (let (last-command this-command) | 577 | (let* ((stop-point (posn-point (event-end event))) |
| 578 | (push-mark (overlay-start mouse-drag-overlay) t t) | 578 | ;; The end that comes from where we ended the drag. |
| 579 | (goto-char (overlay-end mouse-drag-overlay)) | 579 | ;; Point goes here. |
| 580 | (region-termination | ||
| 581 | (if (< stop-point start-point) | ||
| 582 | (overlay-start mouse-drag-overlay) | ||
| 583 | (overlay-end mouse-drag-overlay))) | ||
| 584 | ;; The end that comes from where we started the drag. | ||
| 585 | ;; Mark goes there. | ||
| 586 | (region-commencement | ||
| 587 | (- (+ (overlay-end mouse-drag-overlay) | ||
| 588 | (overlay-start mouse-drag-overlay)) | ||
| 589 | region-termination)) | ||
| 590 | last-command this-command) | ||
| 591 | (push-mark region-commencement t t) | ||
| 592 | (goto-char region-termination) | ||
| 580 | (copy-region-as-kill (point) (mark t)) | 593 | (copy-region-as-kill (point) (mark t)) |
| 581 | (mouse-show-mark) | 594 | (mouse-show-mark) |
| 582 | (mouse-set-region-1)) | 595 | (mouse-set-region-1)) |