More correct clamping of cursor to end of lines.