changeset 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 a843426fc81b
children 13402923c819
files src/terminal.c src/version.c
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
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)
--- a/src/version.c
+++ b/src/version.c
@@ -793,6 +793,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    491,
+/**/
     490,
 /**/
     489,