The DOM element representing the line of text.
The target column position within the line (0-based).
An object containing the text node and the offset
within that node corresponding to the column position, or null if no nodes are found.
Finds and returns the DOM element corresponding to a given screen row.
The screen row number for which to find the element.
The DOM element corresponding to the screen row, or null if not found.
Measures the horizontal position (in pixels) of a specific screen column within a given line element. This method calculates the pixel offset from the left edge of the text layer's container to the specified column.
The DOM element representing the line of text.
The screen column index to measure.
The horizontal position (in pixels) of the specified column relative to the left edge of the text layer's container. If the position cannot be determined, it falls back to an approximation based on the character width.
Converts a pixel position (x-coordinate) to a screen column index within a given row.
The row index on the screen.
Screen column if text was monospace.
The x-coordinate (in pixels) to convert to a column index.
Whether the cursor is in block mode.
OptionalisTextWidthCoordinate: booleanWhether x is in the same coordinate space as textWidth().
The calculated screen column index corresponding to the x-coordinate.
Optionalsize: { height: number; width: number }Calculates and returns an array of rectangles representing the visual positions of a range of text between two screen positions within a text layer.
The starting screen position of the range.
The column index of the starting position.
The row index of the starting position.
The ending screen position of the range.
The column index of the ending position.
The row index of the ending position.
An array of rectangle objects representing the visual positions of the text range. Each rectangle object contains:
left {number}: The left offset of the rectangle relative to the text layer.width {number}: The width of the rectangle.
If an error occurs or the line element is not found, a fallback rectangle is returned
based on character width and column positions.Calculates the width of the text up to a specific screenColumn on a given screen row.
The row index on the screen for which the text width is calculated.
The column index up to which the text width is measured.
The width of the text in pixels up to the specified column.
Finds the position of a specific column within a line element.
This method traverses the text nodes within the given line element to locate the node and offset corresponding to the specified screen column. If the column exceeds the total length of the text, it returns the last node and its length.