Crash fix for autocomplete provider when newline is \r\n