summaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-07-17 14:18:08 +0200
committerBram Moolenaar <Bram@vim.org>2015-07-17 14:18:08 +0200
commit34d72d4b6c1a2b04a214d8a49b7d22c97bc7a8bc (patch)
tree82675f2f5f49bcb04e8271de9fefee41b3c2ec19 /src/fileio.c
parent2cf6938706ebcd20e4b4a6723f5f70568b26b1c6 (diff)
patch 7.4.785v7.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)
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 9965920c5c..fb14dbf7ee 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2623,10 +2623,10 @@ failed:
#endif
/*
- * Trick: We remember if the last line of the read didn't have
- * an eol even when 'binary' is off, for when writing it again with
- * 'binary' on. This is required for
- * ":autocmd FileReadPost *.gz set bin|'[,']!gunzip" to work.
+ * We remember if the last line of the read didn't have
+ * an eol even when 'binary' is off, to support turning 'fixeol' off,
+ * or writing the read again with 'binary' on. The latter is required
+ * for ":autocmd FileReadPost *.gz set bin|'[,']!gunzip" to work.
*/
curbuf->b_no_eol_lnum = read_no_eol_lnum;
@@ -4547,7 +4547,7 @@ restore_backup:
/* write failed or last line has no EOL: stop here */
if (end == 0
|| (lnum == end
- && write_bin
+ && (write_bin || !buf->b_p_fixeol)
&& (lnum == buf->b_no_eol_lnum
|| (lnum == buf->b_ml.ml_line_count && !buf->b_p_eol))))
{