> home > Custom Layer Boundary API

view_pos_from_relative_character

September 8th 2024
Compute the byte position associated with the start of a particular character specified relative to the first character of a particular line

Signature

C++
i64
view_pos_from_relative_character(Application_Links* app,
                                 View_ID view_id,
                                 i64 base_line,
                                 i64 character);

Parameters

app

the standard custom layer context pointer

view_id

the id of the view who's layout will be measured

base_line

the line number of the line that serves as the relative starting point of the measurement

character

the relative character index of the query character, based at the first character of base line

Return

the byte index associated with the start of the character specified by the the base_line and relative_character parameters on success, when the view exists and contains the base line, zero otherwise

Details

Line numbers are 1 based.
Equivalent to calling the buffer related function of the same name by deriving the buffer, width, and face from the view.