diff options
| author | Richard M. Stallman | 1995-06-29 22:19:13 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-06-29 22:19:13 +0000 |
| commit | c8c5bd244729f6e6b52e35839115fda0d85564fc (patch) | |
| tree | 6f793a8819604e0c3d52f08cbabd440f01256aa4 | |
| parent | fe185b94aba626a61d8d28eab3d202873fada051 (diff) | |
| download | emacs-c8c5bd244729f6e6b52e35839115fda0d85564fc.tar.gz emacs-c8c5bd244729f6e6b52e35839115fda0d85564fc.zip | |
(mouse-selection-click-count-buffer): New variable.
(mouse-drag-region): Set it.
(mouse-save-then-kill): Test it.
| -rw-r--r-- | lisp/mouse.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index dbd3ac263ff..84daf4b4a91 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -380,6 +380,8 @@ Upon exit, point is at the far edge of the newly visible text." | |||
| 380 | 380 | ||
| 381 | (defvar mouse-selection-click-count 0) | 381 | (defvar mouse-selection-click-count 0) |
| 382 | 382 | ||
| 383 | (defvar mouse-selection-click-count-buffer nil) | ||
| 384 | |||
| 383 | (defun mouse-drag-region (start-event) | 385 | (defun mouse-drag-region (start-event) |
| 384 | "Set the region to the text that the mouse is dragged over. | 386 | "Set the region to the text that the mouse is dragged over. |
| 385 | Highlight the drag area as you move the mouse. | 387 | Highlight the drag area as you move the mouse. |
| @@ -400,6 +402,7 @@ release the mouse button. Otherwise, it does not." | |||
| 400 | (1- (nth 3 bounds)))) | 402 | (1- (nth 3 bounds)))) |
| 401 | (click-count (1- (event-click-count start-event)))) | 403 | (click-count (1- (event-click-count start-event)))) |
| 402 | (setq mouse-selection-click-count click-count) | 404 | (setq mouse-selection-click-count click-count) |
| 405 | (setq mouse-selection-click-count-buffer (current-buffer)) | ||
| 403 | (mouse-set-point start-event) | 406 | (mouse-set-point start-event) |
| 404 | (let ((range (mouse-start-end start-point start-point click-count))) | 407 | (let ((range (mouse-start-end start-point start-point click-count))) |
| 405 | (move-overlay mouse-drag-overlay (car range) (nth 1 range) | 408 | (move-overlay mouse-drag-overlay (car range) (nth 1 range) |
| @@ -655,7 +658,12 @@ If you do this twice in the same position, the selection is killed." | |||
| 655 | ;; Don't let a subsequent kill command append to this one: | 658 | ;; Don't let a subsequent kill command append to this one: |
| 656 | ;; prevent setting this-command to kill-region. | 659 | ;; prevent setting this-command to kill-region. |
| 657 | (this-command this-command)) | 660 | (this-command this-command)) |
| 658 | (if (and (mark t) (> (mod mouse-selection-click-count 3) 0)) | 661 | (if (and (save-excursion |
| 662 | (set-buffer (window-buffer (posn-window (event-start click)))) | ||
| 663 | (and (mark t) (> (mod mouse-selection-click-count 3) 0) | ||
| 664 | ;; Don't be fooled by a recent click in some other buffer. | ||
| 665 | (eq mouse-selection-click-count-buffer | ||
| 666 | (current-buffer))))) | ||
| 659 | (if (not (and (eq last-command 'mouse-save-then-kill) | 667 | (if (not (and (eq last-command 'mouse-save-then-kill) |
| 660 | (equal click-posn | 668 | (equal click-posn |
| 661 | (car (cdr-safe (cdr-safe mouse-save-then-kill-posn)))))) | 669 | (car (cdr-safe (cdr-safe mouse-save-then-kill-posn)))))) |