0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.4.635

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)
This commit is contained in:
Bram Moolenaar
2015-02-17 14:15:19 +01:00
parent f65aad5554
commit 05eb612ff3
2 changed files with 12 additions and 0 deletions

View File

@@ -2101,6 +2101,10 @@ rewind_retry:
{ {
for (p = ptr; p < ptr + size; ++p) for (p = ptr; p < ptr + size; ++p)
{ {
/* Reset the carriage return counter. */
if (try_mac)
try_mac = 1;
if (*p == NL) if (*p == NL)
{ {
if (!try_unix if (!try_unix
@@ -2110,6 +2114,8 @@ rewind_retry:
fileformat = EOL_UNIX; fileformat = EOL_UNIX;
break; break;
} }
else if (*p == CAR && try_mac)
try_mac++;
} }
/* Don't give in to EOL_UNIX if EOL_MAC is more likely */ /* Don't give in to EOL_UNIX if EOL_MAC is more likely */
@@ -2133,6 +2139,10 @@ rewind_retry:
fileformat = EOL_MAC; 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 */ /* No NL found: may use Mac format */

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
635,
/**/ /**/
634, 634,
/**/ /**/