Function: ghostel-mouse-drag-or-set-region
ghostel-mouse-drag-or-set-region is an interactive and natively
compiled function defined in ghostel.el.
Signature
(ghostel-mouse-drag-or-set-region EVENT)
Documentation
Forward EVENT to the terminal, or hand off to mouse-set-region.
Companion to ghostel-mouse-press-or-copy-mode for the left-button
drag event. Without terminal mouse input, defers to Emacs's
standard drag handler so the selection survives release; without
this, mouse-drag-tracks exit hook deactivates the mark and our
intercept keeps mouse-set-region from re-establishing the region.
When the buffer is in semi-char mode, switches input mode once the
region is set to the mode configured in ghostel-mouse-drag-input-mode.
An empty drag (a click that wiggled into a drag event without selecting
anything) is dispatched to ghostel-mouse-release-or-set-point,
so a focus click stays in semi-char like a plain click.
Key Bindings
ghostel-mode-map <drag-mouse-1>
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-mouse-drag-or-set-region (event)
"Forward EVENT to the terminal, or hand off to `mouse-set-region'.
Companion to `ghostel-mouse-press-or-copy-mode' for the left-button
drag event. Without terminal mouse input, defers to Emacs's
standard drag handler so the selection survives release; without
this, `mouse-drag-track's exit hook deactivates the mark and our
intercept keeps `mouse-set-region' from re-establishing the region.
When the buffer is in semi-char mode, switches input mode once the
region is set to the mode configured in `ghostel-mouse-drag-input-mode'.
An empty drag (a click that wiggled into a drag event without selecting
anything) is dispatched to `ghostel-mouse-release-or-set-point',
so a focus click stays in semi-char like a plain click."
(interactive "e")
(cond
((ghostel--mouse-drag event))
;; An empty drag selected nothing: the wiggle was really a click
((eq (posn-point (event-start event))
(posn-point (event-end event)))
(ghostel-mouse-release-or-set-point event))
(t
(mouse-set-region event)
(when (eq ghostel--input-mode 'semi-char)
(ghostel--enter-readonly-input-mode ghostel-mouse-drag-input-mode)))))