fix cursor position on lines with leading whitespaces