For any insertion point, the number of bytes between that insertion point and the end of the line is returned. The visual, not logical, insertion point is used. If the insertion point is -1, the cursor position is used. If the line contains a hard line-break, it is counted as one byte.
The term line means a line on the display after the application of word-wrap. It does not mean a line as defined by the CR LF line-break sequence.