Function: ghostel--mouse-drag

ghostel--mouse-drag is an interactive and natively compiled function defined in ghostel.el.

Signature

(ghostel--mouse-drag EVENT)

Documentation

Handle drag-end EVENT as a button release for terminal mouse tracking.

A drag-mouse-N event is only delivered at the *end* of a drag, so it marks the button release. Live motion during the drag is streamed separately by ghostel--mouse-drag-motion; this handler's job is to complete the protocol with a release at the final position. (Sending a release rather than a motion also matters for DEC mode 1000, which reports releases but never motion.) Return non-nil when the event was encoded and sent to the terminal.

Key Bindings

ghostel-char-mode-map <drag-mouse-1> ghostel-char-mode-map <drag-mouse-2> ghostel-char-mode-map <drag-mouse-3> ghostel-mode-map <drag-mouse-2> ghostel-mode-map <drag-mouse-3>

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--mouse-drag (event)
  "Handle drag-end EVENT as a button release for terminal mouse tracking.
A `drag-mouse-N' event is only delivered at the *end* of a drag, so it marks
the button release.  Live motion during the drag is streamed separately by
`ghostel--mouse-drag-motion'; this handler's job is to complete the protocol
with a release at the final position.  (Sending a release rather than a motion
also matters for DEC mode 1000, which reports releases but never motion.)
Return non-nil when the event was encoded and sent to the terminal."
  (interactive "e")
  (when (or ghostel--mouse-drag-button
            (ghostel--terminal-input-mode-p))
    (let* ((posn (event-end event))
           (col-row (ghostel--posn-cell posn))
           (col (car col-row))
           (row (cdr col-row)))
      (ghostel--mouse-event ghostel--term
                            1  ; release
                            (ghostel--mouse-button-number event)
                            row col
                            (ghostel--mouse-mods event)))))