nearestCommentAnchorIndex method
Returns the nearest comment-anchor index at or after renderLine.
Implementation
int nearestCommentAnchorIndex(int renderLine) {
if (commentAnchors.isEmpty) return 0;
final index = commentAnchors.indexWhere(
(anchor) => anchor.renderLine >= renderLine,
);
return index >= 0 ? index : commentAnchors.length - 1;
}