Returns the last position of a given line.
If the line ends with invisible items (such as a carriage return) and visible? is not #f, the invisble items are skipped over.