Fix a crash when moving between lines with multibyte characters