Commit 33d79bad authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(mouse-show-mark): Detect loss of selection

while we are showing it highlighted.
parent a8abaf83
......@@ -743,22 +743,32 @@ If DIR is positive skip forward; if negative, skip backward."
(if window-system
(let ((inhibit-quit t)
(echo-keystrokes 0)
event events key)
event events key ignore
(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))
(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)))))
(not (mouse-undouble-last-event events))))))
;; If we lost the selection, just turn off the highlighting.
(if ignore
;; 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)))
(nconc events unread-command-events))))
(setq quit-flag nil)
(delete-overlay mouse-drag-overlay))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment