Function: aw-offset

aw-offset is a byte-compiled function defined in ace-window.el.

Signature

(aw-offset WINDOW)

Documentation

Return point in WINDOW that's closest to top left corner.

The point is writable, i.e. it's not part of space after newline.

Source Code

;; Defined in ~/.emacs.d/elpa/ace-window-20220911.358/ace-window.el
(defun aw-offset (window)
  "Return point in WINDOW that's closest to top left corner.
The point is writable, i.e. it's not part of space after newline."
  (let ((h (window-hscroll window))
        (beg (window-start window))
        (end (window-end window))
        (inhibit-field-text-motion t))
    (with-current-buffer (window-buffer window)
      (save-excursion
        (goto-char beg)
        (forward-line (1-
                       (min
                        (count-lines
                         (point)
                         (point-max))
                        (aw--face-rel-height))))
        (while (and (< (point) end)
                    (< (- (line-end-position)
                          (line-beginning-position))
                       h))
          (forward-line))
        (+ (point) h)))))