]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.4.635 v7.4.635
authorBram Moolenaar <Bram@vim.org>
Tue, 17 Feb 2015 13:15:19 +0000 (14:15 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 17 Feb 2015 13:15:19 +0000 (14:15 +0100)
Problem:    If no NL or CR is found in the first block of a file then the
            'fileformat' may be set to "mac". (Issue 77)
Solution:   Check if a CR was found. (eswald)

src/fileio.c
src/version.c

index 47814fab9a0708fde61ee0be8c95c3238f93f6e3..319c7ba9758b6c9548747ad501c7d5670de6461b 100644 (file)
@@ -2101,6 +2101,10 @@ rewind_retry:
                {
                    for (p = ptr; p < ptr + size; ++p)
                    {
+                       /* Reset the carriage return counter. */
+                       if (try_mac)
+                           try_mac = 1;
+
                        if (*p == NL)
                        {
                            if (!try_unix
@@ -2110,6 +2114,8 @@ rewind_retry:
                                fileformat = EOL_UNIX;
                            break;
                        }
+                       else if (*p == CAR && try_mac)
+                           try_mac++;
                    }
 
                    /* Don't give in to EOL_UNIX if EOL_MAC is more likely */
@@ -2133,6 +2139,10 @@ rewind_retry:
                                fileformat = EOL_MAC;
                        }
                    }
+                   else if (fileformat == EOL_UNKNOWN && try_mac == 1)
+                       /* Looking for CR but found no end-of-line markers at
+                        * all: use the default format. */
+                       fileformat = default_fileformat();
                }
 
                /* No NL found: may use Mac format */
index 3d493b0545c70228beb9faeb2d73a3135fd8a608..0c2004116edabbeb13de9496ae2aea49b2b85916 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    635,
 /**/
     634,
 /**/