Mercurial > emacs
comparison lisp/mouse.el @ 23611:4c8718a0fb85
(mouse-drag-region): Fake up a mouse-motion event
if we did not get one for the final move.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Nov 1998 18:17:40 +0000 |
parents | dfb255fb91c8 |
children | 0813c9bb52c4 |
comparison
equal
deleted
inserted
replaced
23610:73c884a6f03c | 23611:4c8718a0fb85 |
---|---|
583 ;; Without this, point tends to jump back to the starting | 583 ;; Without this, point tends to jump back to the starting |
584 ;; position where the mouse button was pressed down. | 584 ;; position where the mouse button was pressed down. |
585 (setq end-of-range (overlay-start mouse-drag-overlay))) | 585 (setq end-of-range (overlay-start mouse-drag-overlay))) |
586 ((>= mouse-row bottom) | 586 ((>= mouse-row bottom) |
587 (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) | 587 (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) |
588 mouse-drag-overlay start-point) | 588 a mouse-drag-overlay start-point) |
589 (setq end-of-range (overlay-end mouse-drag-overlay)))))))))) | 589 (setq end-of-range (overlay-end mouse-drag-overlay)))))))))) |
590 ;; In case we did not get a mouse-motion event | |
591 ;; for the final move of the mouse before a drag event | |
592 ;; pretend that we did get one. | |
593 (when (and (memq 'drag (event-modifiers (car-safe event))) | |
594 (setq end (event-end event) | |
595 end-point (posn-point end)) | |
596 (eq (posn-window end) start-window) | |
597 (integer-or-marker-p end-point)) | |
598 | |
599 ;; Go to START-POINT first, so that when we move to END-POINT, | |
600 ;; if it's in the middle of intangible text, | |
601 ;; point jumps in the direction away from START-POINT. | |
602 (goto-char start-point) | |
603 (goto-char end-point) | |
604 (if (zerop (% click-count 3)) | |
605 (setq end-of-range (point))) | |
606 (let ((range (mouse-start-end start-point (point) click-count))) | |
607 (move-overlay mouse-drag-overlay (car range) (nth 1 range)))) | |
608 | |
590 (if (consp event) | 609 (if (consp event) |
591 (let ((fun (key-binding (vector (car event))))) | 610 (let ((fun (key-binding (vector (car event))))) |
592 ;; Run the binding of the terminating up-event, if possible. | 611 ;; Run the binding of the terminating up-event, if possible. |
593 ;; In the case of a multiple click, it gives the wrong results, | 612 ;; In the case of a multiple click, it gives the wrong results, |
594 ;; because it would fail to set up a region. | 613 ;; because it would fail to set up a region. |