Mercurial > emacs
comparison lisp/mouse.el @ 18459:688c725c6b23
(mouse-drag-region): For a click (not a drag),
let the up-event run normally.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 27 Jun 1997 04:23:52 +0000 |
parents | 56f88318699c |
children | 828ca7cea30f |
comparison
equal
deleted
inserted
replaced
18458:96905485f262 | 18459:688c725c6b23 |
---|---|
571 (if (consp event) | 571 (if (consp event) |
572 (let ((fun (key-binding (vector (car event))))) | 572 (let ((fun (key-binding (vector (car 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 (overlay-start mouse-drag-overlay) | |
587 (overlay-end mouse-drag-overlay))) | |
588 ;; The end that comes from where we started the drag. | |
589 ;; Mark goes there. | |
590 (region-commencement | |
591 (- (+ (overlay-end mouse-drag-overlay) | |
592 (overlay-start mouse-drag-overlay)) | |
593 region-termination)) | |
594 last-command this-command) | |
595 (push-mark region-commencement t t) | |
596 (goto-char region-termination) | |
597 (copy-region-as-kill (point) (mark t)) | |
598 (let ((buffer (current-buffer))) | |
599 (mouse-show-mark) | |
600 ;; mouse-show-mark can call read-event, | |
601 ;; and that means the Emacs server could switch buffers | |
602 ;; under us. If that happened, | |
603 ;; avoid trying to use the region. | |
604 (and (mark t) mark-active | |
605 (eq buffer (current-buffer)) | |
606 (mouse-set-region-1)))) | |
607 (delete-overlay mouse-drag-overlay) | |
608 ;; Run the binding of the terminating up-event. | |
609 (if (fboundp fun) | |
586 (setq unread-command-events | 610 (setq unread-command-events |
587 (cons event unread-command-events))) | 611 (cons event unread-command-events))))) |
588 (if (not (= (overlay-start mouse-drag-overlay) | |
589 (overlay-end mouse-drag-overlay))) | |
590 (let* ((stop-point | |
591 (if (numberp (posn-point (event-end event))) | |
592 (posn-point (event-end event)) | |
593 last-end-point)) | |
594 ;; The end that comes from where we ended the drag. | |
595 ;; Point goes here. | |
596 (region-termination | |
597 (if (and stop-point (< stop-point start-point)) | |
598 (overlay-start mouse-drag-overlay) | |
599 (overlay-end mouse-drag-overlay))) | |
600 ;; The end that comes from where we started the drag. | |
601 ;; Mark goes there. | |
602 (region-commencement | |
603 (- (+ (overlay-end mouse-drag-overlay) | |
604 (overlay-start mouse-drag-overlay)) | |
605 region-termination)) | |
606 last-command this-command) | |
607 (push-mark region-commencement t t) | |
608 (goto-char region-termination) | |
609 (copy-region-as-kill (point) (mark t)) | |
610 (let ((buffer (current-buffer))) | |
611 (mouse-show-mark) | |
612 ;; mouse-show-mark can call read-event, | |
613 ;; and that means the Emacs server could switch buffers | |
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. |
625 | 615 |
626 (defun mouse-skip-word (dir) | 616 (defun mouse-skip-word (dir) |