Function: ghostel--mouse-press

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

Signature

(ghostel--mouse-press EVENT)

Documentation

Handle mouse button press EVENT for terminal mouse tracking.

Return non-nil when the event was encoded and sent to the terminal.

Key Bindings

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

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--mouse-press (event)
  "Handle mouse button press EVENT for terminal mouse tracking.
Return non-nil when the event was encoded and sent to the terminal."
  (interactive "e")
  (when (ghostel--terminal-input-mode-p)
    (select-window (posn-window (event-start event)))
    (let* ((posn (event-start event))
           (col-row (ghostel--posn-cell posn))
           (col (car col-row))
           (row (cdr col-row))
           (sent (ghostel--mouse-event ghostel--term
                                       0  ; press
                                       (ghostel--mouse-button-number event)
                                       row col
                                       (ghostel--mouse-mods event))))
      (when sent
        ;; Emacs only emits `mouse-movement' events while `track-mouse'is non-nil,
        ;; and coalesces a drag into a single `drag-mouse-N' event at release.
        ;; To give the running program a live motion stream during the drag,
        ;; start tracking after libghostty accepts the press.
        (ghostel--mouse-begin-drag-tracking event))
      sent)))