Function: ghostel--wrap-pos-to-offset
ghostel--wrap-pos-to-offset is a natively compiled function defined in
ghostel-links.el.
Signature
(ghostel--wrap-pos-to-offset POS CHUNKS)
Documentation
Return the string offset for buffer POS given CHUNKS.
Inverse of ghostel--wrap-offset-to-pos. A POS on a wrap newline
maps to the offset of the next row's first character, since the
newline itself is not part of the joined string.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
;;; thing-at-point and ffap across soft-wrapped rows
(defun ghostel--wrap-pos-to-offset (pos chunks)
"Return the string offset for buffer POS given CHUNKS.
Inverse of `ghostel--wrap-offset-to-pos'. A POS on a wrap newline
maps to the offset of the next row's first character, since the
newline itself is not part of the joined string."
(let ((i (1- (length chunks))))
(while (and (> i 0) (> (cdr (aref chunks i)) pos))
(setq i (1- i)))
(let ((chunk (aref chunks i)))
(+ (car chunk) (- pos (cdr chunk))))))