summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-06-03 17:21:03 +0000
committerRichard M. Stallman <rms@gnu.org>1996-06-03 17:21:03 +0000
commit67633d4bafbd376fcffccea56f31ea0b9402aad2 (patch)
tree25000dbea1d5921fd52df65b748da03977d0fed5
parent076ff498f22fbdef63f00937ce639276a4fe2a79 (diff)
downloademacs-67633d4bafbd376fcffccea56f31ea0b9402aad2.tar.gz
(mouse-show-mark): Use temporary highlighting if possible instead of a pause.
(mouse-drag-region): Use mouse-show-mark to do temp highlighting. (mouse-save-then-kill): Call mouse-show-mark for a new selection if we have a window system.
-rw-r--r--lisp/mouse.el33
1 files changed, 23 insertions, 10 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 00a53d6c8fc..351d9fcd1a9 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -578,12 +578,8 @@ remains active. Otherwise, it remains until the next input event."
(push-mark (overlay-start mouse-drag-overlay) t t)
(goto-char (overlay-end mouse-drag-overlay))
(copy-region-as-kill (point) (mark t))
- (let ((inhibit-quit t))
- (setq unread-command-events
- (cons (read-event) unread-command-events))
- (setq quit-flag nil))
- (mouse-set-region-1)
- (delete-overlay mouse-drag-overlay))
+ (mouse-show-mark)
+ (mouse-set-region-1))
(goto-char (overlay-end mouse-drag-overlay))
(setq this-command 'mouse-set-point)
(delete-overlay mouse-drag-overlay))))
@@ -673,9 +669,22 @@ If DIR is positive skip forward; if negative, skip backward."
;; Momentarily show where the mark is, if highlighting doesn't show it.
(defun mouse-show-mark ()
(or transient-mark-mode
- (save-excursion
- (goto-char (mark t))
- (sit-for 1))))
+ (if window-system
+ (let ((inhibit-quit t)
+ (echo-keystrokes 0)
+ event events)
+ (move-overlay mouse-drag-overlay (point) (mark t))
+ (while (progn (setq event (read-event))
+ (setq events (append events (list event)))
+ (and (memq 'down (event-modifiers event))
+ (not (key-binding (apply 'vector events))))))
+ (setq unread-command-events
+ (nconc events unread-command-events))
+ (setq quit-flag nil)
+ (delete-overlay mouse-drag-overlay))
+ (save-excursion
+ (goto-char (mark t))
+ (sit-for 1)))))
(defun mouse-set-mark (click)
"Set mark at the position clicked on with the mouse.
@@ -833,6 +842,8 @@ If you do this twice in the same position, the selection is killed."
(mouse-save-then-kill-delete-region (point) (mark))
;; After we kill, another click counts as "the first time".
(setq mouse-save-then-kill-posn nil))
+ ;; This is not a repetition.
+ ;; We are adjusting an old selection or creating a new one.
(if (or (and (eq last-command 'mouse-save-then-kill)
mouse-save-then-kill-posn)
(and mark-active transient-mark-mode)
@@ -859,7 +870,9 @@ If you do this twice in the same position, the selection is killed."
(if before-scroll
(goto-char before-scroll))
(exchange-point-and-mark)
- (kill-new (buffer-substring (point) (mark t))))
+ (kill-new (buffer-substring (point) (mark t)))
+ (if window-system
+ (mouse-show-mark)))
(mouse-set-region-1)
(setq mouse-save-then-kill-posn
(list (car kill-ring) (point) click-posn)))))))