diff src/terminal.c @ 14960:47931abb9f31 v8.1.0491

patch 8.1.0491: if a terminal dump has CR it is considered corrupt commit https://github.com/vim/vim/commit/0fd6be77de6c1570bd320fc89ba82b7018ac29ae Author: Bram Moolenaar <Bram@vim.org> Date: Tue Oct 23 21:42:59 2018 +0200 patch 8.1.0491: if a terminal dump has CR it is considered corrupt Problem: If a terminal dump has CR it is considered corrupt. Solution: Ignore CR characters. (Nobuhiro Takasaki, closes https://github.com/vim/vim/issues/3558)
author Bram Moolenaar <Bram@vim.org>
date Tue, 23 Oct 2018 21:45:06 +0200
parents c085c4cd9bba
children f3b4cd98944c
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -4094,7 +4094,12 @@ read_dump_file(FILE *fd, VTermPos *curso
     {
 	if (c == EOF)
 	    break;
-	if (c == '\n')
+	if (c == '\r')
+	{
+	    // DOS line endings?  Ignore.
+	    c = fgetc(fd);
+	}
+	else if (c == '\n')
 	{
 	    /* End of a line: append it to the buffer. */
 	    if (ga_text.ga_data == NULL)