Skip to content

vyaz-monorepo / renderers/src / charIndexToPos

Function: charIndexToPos() ​

charIndexToPos(lines, charIndex): CharPos | null

Defined in: renderers/src/interactive.ts:214

Convert a global character index (startIndex / endIndex from Line) to a CharPos.

Useful for mapping cursor/selection from a text model to layout position.

Returns null if the index is out of range.

Parameters ​

lines ​

Line[]

charIndex ​

number

Returns ​

CharPos | null

Released under the MIT License.