Function: ghostel--wrap-offset-to-pos
ghostel--wrap-offset-to-pos is a natively compiled function defined in
ghostel-links.el.
Signature
(ghostel--wrap-offset-to-pos OFFSET CHUNKS)
Documentation
Return the buffer position for STRING OFFSET given CHUNKS.
CHUNKS is the map returned by ghostel--wrap-joined-region.
Binary search, so a region with thousands of rows stays cheap to map.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
(defun ghostel--wrap-offset-to-pos (offset chunks)
"Return the buffer position for STRING OFFSET given CHUNKS.
CHUNKS is the map returned by `ghostel--wrap-joined-region'.
Binary search, so a region with thousands of rows stays cheap to map."
(unless (zerop (length chunks))
(let ((low 0)
(high (1- (length chunks))))
(while (< low high)
(let ((mid (/ (+ low high 1) 2)))
(if (<= (car (aref chunks mid)) offset)
(setq low mid)
(setq high (1- mid)))))
(let ((chunk (aref chunks low)))
(+ (cdr chunk) (- offset (car chunk)))))))