Function: pixel-point-and-height-at-unseen-line

pixel-point-and-height-at-unseen-line is a byte-compiled function defined in pixel-scroll.el.gz.

Signature

(pixel-point-and-height-at-unseen-line)

Documentation

Return the position and pixel height of line above the selected window.

The returned value is a cons of the position of the first character on the unseen line just above the scope of current window, and the pixel height of that line.

Source Code

;; Defined in /usr/src/emacs/lisp/pixel-scroll.el.gz
(defun pixel-point-and-height-at-unseen-line ()
  "Return the position and pixel height of line above the selected window.
The returned value is a cons of the position of the first
character on the unseen line just above the scope of current
window, and the pixel height of that line."
  (let* ((pos0 (save-excursion
                 (goto-char (window-start))
                 (unless (bobp)
                   (beginning-of-visual-line))
                 (point)))
         (vscroll0 (window-vscroll nil t))
         (line-height nil)
         (pos
          (save-excursion
            (goto-char pos0)
            (if (bobp)
                (point-min)
              (vertical-motion -1)
              (setq line-height
                    (cdr (window-text-pixel-size nil (point) pos0)))
              (point)))))
    ;; restore initial position
    (set-window-start nil pos0 t)
    (set-window-vscroll nil vscroll0 t)
    (when (and line-height
               (> (car (posn-x-y (posn-at-point pos0)))
                  (line-number-display-width t)))
      (setq line-height (- line-height
                           (save-excursion
                             (goto-char pos0)
                             (line-pixel-height)))))
    (cons pos line-height)))