Map a pixel point to a caret index. y selects the line (clamped to the first/last line); x follows the half-glyph rule and clamps to the line's visible end, so a click past the end of a line never lands beyond its newline.
y
x
Map a pixel point to a caret index.
yselects the line (clamped to the first/last line);xfollows the half-glyph rule and clamps to the line's visible end, so a click past the end of a line never lands beyond its newline.