diff options
| author | Richard M. Stallman | 1997-06-27 04:23:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-06-27 04:23:52 +0000 |
| commit | bb3aa8352fa15c0d5916cc904dfd53b7070aee23 (patch) | |
| tree | 38d11a7e23ab0722c4081c12a7977d253f41bd91 /lisp/mouse.el | |
| parent | 12c226c5e38901fac483526fc11462bbba47eb3a (diff) | |
| download | emacs-bb3aa8352fa15c0d5916cc904dfd53b7070aee23.tar.gz emacs-bb3aa8352fa15c0d5916cc904dfd53b7070aee23.zip | |
(mouse-drag-region): For a click (not a drag),
let the up-event run normally.
Diffstat (limited to 'lisp/mouse.el')
| -rw-r--r-- | lisp/mouse.el | 80 |
1 files changed, 35 insertions, 45 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 410a9ff6b19..29bc077218d 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -573,52 +573,42 @@ remains active. Otherwise, it remains until the next input event." | |||
| 573 | ;; Run the binding of the terminating up-event, if possible. | 573 | ;; Run the binding of the terminating up-event, if possible. |
| 574 | ;; In the case of a multiple click, it gives the wrong results, | 574 | ;; In the case of a multiple click, it gives the wrong results, |
| 575 | ;; because it would fail to set up a region. | 575 | ;; because it would fail to set up a region. |
| 576 | (if nil ;; (and (= (mod mouse-selection-click-count 3) 0) (fboundp fun)) | 576 | (if (not (= (overlay-start mouse-drag-overlay) |
| 577 | ;; In this case, we can just let the up-event execute normally. | 577 | (overlay-end mouse-drag-overlay))) |
| 578 | (let ((end (event-end event))) | 578 | (let* ((stop-point |
| 579 | ;; Set the position in the event before we replay it, | 579 | (if (numberp (posn-point (event-end event))) |
| 580 | ;; because otherwise it may have a position in the wrong | 580 | (posn-point (event-end event)) |
| 581 | ;; buffer. | 581 | last-end-point)) |
| 582 | (setcar (cdr end) end-of-range) | 582 | ;; The end that comes from where we ended the drag. |
| 583 | ;; Delete the overlay before calling the function, | 583 | ;; Point goes here. |
| 584 | ;; because delete-overlay increases buffer-modified-tick. | 584 | (region-termination |
| 585 | (delete-overlay mouse-drag-overlay) | 585 | (if (and stop-point (< stop-point start-point)) |
| 586 | (setq unread-command-events | 586 | (overlay-start mouse-drag-overlay) |
| 587 | (cons event unread-command-events))) | ||
| 588 | (if (not (= (overlay-start mouse-drag-overlay) | ||
| 589 | (overlay-end mouse-drag-overlay))) | 587 | (overlay-end mouse-drag-overlay))) |
| 590 | (let* ((stop-point | 588 | ;; The end that comes from where we started the drag. |
| 591 | (if (numberp (posn-point (event-end event))) | 589 | ;; Mark goes there. |
| 592 | (posn-point (event-end event)) | 590 | (region-commencement |
| 593 | last-end-point)) | 591 | (- (+ (overlay-end mouse-drag-overlay) |
| 594 | ;; The end that comes from where we ended the drag. | 592 | (overlay-start mouse-drag-overlay)) |
| 595 | ;; Point goes here. | 593 | region-termination)) |
| 596 | (region-termination | 594 | last-command this-command) |
| 597 | (if (and stop-point (< stop-point start-point)) | 595 | (push-mark region-commencement t t) |
| 598 | (overlay-start mouse-drag-overlay) | 596 | (goto-char region-termination) |
| 599 | (overlay-end mouse-drag-overlay))) | 597 | (copy-region-as-kill (point) (mark t)) |
| 600 | ;; The end that comes from where we started the drag. | 598 | (let ((buffer (current-buffer))) |
| 601 | ;; Mark goes there. | 599 | (mouse-show-mark) |
| 602 | (region-commencement | 600 | ;; mouse-show-mark can call read-event, |
| 603 | (- (+ (overlay-end mouse-drag-overlay) | 601 | ;; and that means the Emacs server could switch buffers |
| 604 | (overlay-start mouse-drag-overlay)) | 602 | ;; under us. If that happened, |
| 605 | region-termination)) | 603 | ;; avoid trying to use the region. |
| 606 | last-command this-command) | 604 | (and (mark t) mark-active |
| 607 | (push-mark region-commencement t t) | 605 | (eq buffer (current-buffer)) |
| 608 | (goto-char region-termination) | 606 | (mouse-set-region-1)))) |
| 609 | (copy-region-as-kill (point) (mark t)) | 607 | (delete-overlay mouse-drag-overlay) |
| 610 | (let ((buffer (current-buffer))) | 608 | ;; Run the binding of the terminating up-event. |
| 611 | (mouse-show-mark) | 609 | (if (fboundp fun) |
| 612 | ;; mouse-show-mark can call read-event, | 610 | (setq unread-command-events |
| 613 | ;; and that means the Emacs server could switch buffers | 611 | (cons event unread-command-events))))) |
| 614 | ;; under us. If that happened, | ||
| 615 | ;; avoid trying to use the region. | ||
| 616 | (and (mark t) mark-active | ||
| 617 | (eq buffer (current-buffer)) | ||
| 618 | (mouse-set-region-1)))) | ||
| 619 | (goto-char (overlay-end mouse-drag-overlay)) | ||
| 620 | (setq this-command 'mouse-set-point) | ||
| 621 | (delete-overlay mouse-drag-overlay)))) | ||
| 622 | (delete-overlay mouse-drag-overlay))))) | 612 | (delete-overlay mouse-drag-overlay))))) |
| 623 | 613 | ||
| 624 | ;; Commands to handle xterm-style multiple clicks. | 614 | ;; Commands to handle xterm-style multiple clicks. |