diff src/memline.c @ 6933:62ba356c2d4e v7.4.785

patch 7.4.785 Problem: On some systems automatically adding the missing EOL causes problems. Setting 'binary' has too many side effects. Solution: Add the 'fixeol' option, default on. (Pavel Samarkin)
author Bram Moolenaar <bram@vim.org>
date Fri, 17 Jul 2015 14:18:08 +0200
parents 30c9301f33ed
children c0a23e04c929
line wrap: on
line diff
--- a/src/memline.c
+++ b/src/memline.c
@@ -5361,8 +5361,10 @@ ml_find_line_or_offset(buf, lnum, offp)
 	if (ffdos)
 	    size += lnum - 1;
 
-	/* Don't count the last line break if 'bin' and 'noeol'. */
-	if (buf->b_p_bin && !buf->b_p_eol && buf->b_ml.ml_line_count == lnum)
+	/* Don't count the last line break if 'noeol' and ('bin' or
+	 * 'nofixeol'). */
+	if ((!buf->b_p_fixeol || buf->b_p_bin) && !buf->b_p_eol
+					   && buf->b_ml.ml_line_count == lnum)
 	    size -= ffdos + 1;
     }