selection_rect.mLeft += segment_width;
- // if selection spans end of current segment...
+ // if selection_right == segment_line_end then that means we are the first character of the next segment
+ // or first character of the next line, in either case we want to add the length of the current segment
+ // to the selection rectangle and continue.
+ // if selection right > segment_line_end then selection spans end of current segment...
if (selection_right >= segment_line_end)
// extend selection slightly beyond end of line
else if (hit_past_end_of_line && segmentp->getEnd() >= line_iter->mDocIndexEnd - 1)
- // segment wraps to next line, so just set doc pos to start of next line
+ // segment wraps to next line, so just set doc pos to start of next line
pos = llmin(getLength(), line_iter->mDocIndexEnd);