Karsten Hopp e226be
To: vim_dev@googlegroups.com
Karsten Hopp e226be
Subject: Patch 7.4.635
Karsten Hopp e226be
Fcc: outbox
Karsten Hopp e226be
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp e226be
Mime-Version: 1.0
Karsten Hopp e226be
Content-Type: text/plain; charset=UTF-8
Karsten Hopp e226be
Content-Transfer-Encoding: 8bit
Karsten Hopp e226be
------------
Karsten Hopp e226be
Karsten Hopp e226be
Patch 7.4.635
Karsten Hopp e226be
Problem:    If no NL or CR is found in the first block of a file then the
Karsten Hopp e226be
	    'fileformat' may be set to "mac". (Issue 77)
Karsten Hopp e226be
Solution:   Check if a CR was found. (eswald)
Karsten Hopp e226be
Files:	    src/fileio.c
Karsten Hopp e226be
Karsten Hopp e226be
Karsten Hopp e226be
*** ../vim-7.4.634/src/fileio.c	2015-02-17 10:58:20.479298803 +0100
Karsten Hopp e226be
--- src/fileio.c	2015-02-17 14:06:53.660019143 +0100
Karsten Hopp e226be
***************
Karsten Hopp e226be
*** 2101,2106 ****
Karsten Hopp e226be
--- 2101,2110 ----
Karsten Hopp e226be
  		{
Karsten Hopp e226be
  		    for (p = ptr; p < ptr + size; ++p)
Karsten Hopp e226be
  		    {
Karsten Hopp e226be
+ 			/* Reset the carriage return counter. */
Karsten Hopp e226be
+ 			if (try_mac)
Karsten Hopp e226be
+ 			    try_mac = 1;
Karsten Hopp e226be
+ 
Karsten Hopp e226be
  			if (*p == NL)
Karsten Hopp e226be
  			{
Karsten Hopp e226be
  			    if (!try_unix
Karsten Hopp e226be
***************
Karsten Hopp e226be
*** 2110,2115 ****
Karsten Hopp e226be
--- 2114,2121 ----
Karsten Hopp e226be
  				fileformat = EOL_UNIX;
Karsten Hopp e226be
  			    break;
Karsten Hopp e226be
  			}
Karsten Hopp e226be
+ 			else if (*p == CAR && try_mac)
Karsten Hopp e226be
+ 			    try_mac++;
Karsten Hopp e226be
  		    }
Karsten Hopp e226be
  
Karsten Hopp e226be
  		    /* Don't give in to EOL_UNIX if EOL_MAC is more likely */
Karsten Hopp e226be
***************
Karsten Hopp e226be
*** 2133,2138 ****
Karsten Hopp e226be
--- 2139,2148 ----
Karsten Hopp e226be
  				fileformat = EOL_MAC;
Karsten Hopp e226be
  			}
Karsten Hopp e226be
  		    }
Karsten Hopp e226be
+ 		    else if (fileformat == EOL_UNKNOWN && try_mac == 1)
Karsten Hopp e226be
+ 			/* Looking for CR but found no end-of-line markers at
Karsten Hopp e226be
+ 			 * all: use the default format. */
Karsten Hopp e226be
+ 			fileformat = default_fileformat();
Karsten Hopp e226be
  		}
Karsten Hopp e226be
  
Karsten Hopp e226be
  		/* No NL found: may use Mac format */
Karsten Hopp e226be
*** ../vim-7.4.634/src/version.c	2015-02-17 13:43:35.562216149 +0100
Karsten Hopp e226be
--- src/version.c	2015-02-17 14:00:48.312772284 +0100
Karsten Hopp e226be
***************
Karsten Hopp e226be
*** 743,744 ****
Karsten Hopp e226be
--- 743,746 ----
Karsten Hopp e226be
  {   /* Add new patch number below this line */
Karsten Hopp e226be
+ /**/
Karsten Hopp e226be
+     635,
Karsten Hopp e226be
  /**/
Karsten Hopp e226be
Karsten Hopp e226be
-- 
Karsten Hopp e226be
"Marriage is a wonderful institution...
Karsten Hopp e226be
but who wants to live in an institution?"
Karsten Hopp e226be
 - Groucho Marx
Karsten Hopp e226be
Karsten Hopp e226be
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp e226be
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp e226be
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp e226be
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///