Mercurial > emacs
changeset 16016:2ee7579db4a9
(mouse-show-mark): Detect loss of selection
while we are showing it highlighted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Sep 1996 02:42:04 +0000 |
parents | f51aa92862ac |
children | 96edeb283515 |
files | lisp/mouse.el |
diffstat | 1 files changed, 25 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/mouse.el Sun Sep 01 00:20:33 1996 +0000 +++ b/lisp/mouse.el Sun Sep 01 02:42:04 1996 +0000 @@ -743,22 +743,32 @@ (if window-system (let ((inhibit-quit t) (echo-keystrokes 0) - event events key) + event events key ignore + x-lost-selection-hooks) + (add-hook 'x-lost-selection-hooks + '(lambda (seltype) + (if (eq seltype 'PRIMARY) + (progn (setq ignore t) + (throw 'mouse-show-mark t))))) (move-overlay mouse-drag-overlay (point) (mark t)) - (while (progn (setq event (read-event)) - (setq events (append events (list event))) - (setq key (apply 'vector events)) - (and (memq 'down (event-modifiers event)) - (not (key-binding key)) - (not (member key mouse-region-delete-keys)) - (not (mouse-undouble-last-event events))))) - ;; For certain special keys, delete the region. - (if (member key mouse-region-delete-keys) - (delete-region (overlay-start mouse-drag-overlay) - (overlay-end mouse-drag-overlay)) - ;; Otherwise, unread the key so it gets executed normally. - (setq unread-command-events - (nconc events unread-command-events))) + (catch 'mouse-show-mark + (while (progn (setq event (read-event)) + (setq events (append events (list event))) + (setq key (apply 'vector events)) + (and (memq 'down (event-modifiers event)) + (not (key-binding key)) + (not (member key mouse-region-delete-keys)) + (not (mouse-undouble-last-event events)))))) + ;; If we lost the selection, just turn off the highlighting. + (if ignore + nil + ;; For certain special keys, delete the region. + (if (member key mouse-region-delete-keys) + (delete-region (overlay-start mouse-drag-overlay) + (overlay-end mouse-drag-overlay)) + ;; Otherwise, unread the key so it gets executed normally. + (setq unread-command-events + (nconc events unread-command-events)))) (setq quit-flag nil) (delete-overlay mouse-drag-overlay)) (save-excursion