Function: ghostel--posn-cell

ghostel--posn-cell is a natively compiled function defined in ghostel.el.

Signature

(ghostel--posn-cell POSN)

Documentation

Return (COL . ROW) of POSN in the terminal grid of its window.

Unlike posn-col-row, honors buffer-local text scaling, line-spacing, and the vscroll or pad above the first row.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--posn-cell (posn)
  "Return (COL . ROW) of POSN in the terminal grid of its window.
Unlike `posn-col-row', honors buffer-local text scaling, `line-spacing',
and the vscroll or pad above the first row."
  (let ((xy (posn-x-y posn))
        (win (posn-window posn)))
    (with-selected-window (if (framep win) (frame-selected-window win) win)
      (let* ((lh (default-line-height))
             (vscroll (window-vscroll nil t))
             (top (cond ((> vscroll 0) (- lh vscroll))
                        ((= (window-start) (point-min)) ghostel--top-pad)
                        (t 0))))
        (cons (/ (car xy) (default-font-width))
              (/ (- (cdr xy) top) lh))))))