diff src/option.c @ 2685:862d920800b1 v7.3.103

updated for version 7.3.103 Problem: Changing 'fileformat' and then using ":w" in an empty file sets the 'modified' option. Solution: In unchanged() don't ignore 'ff' for an empty file.
author Bram Moolenaar <bram@vim.org>
date Sat, 22 Jan 2011 00:11:50 +0100
parents 2b475ed86e64
children 0d201adaf9c5
line wrap: on
line diff
--- a/src/option.c
+++ b/src/option.c
@@ -11296,16 +11296,19 @@ save_file_ff(buf)
  * from when editing started (save_file_ff() called).
  * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
  * changed and 'binary' is not set.
- * Don't consider a new, empty buffer to be changed.
+ * When "ignore_empty" is true don't consider a new, empty buffer to be
+ * changed.
  */
     int
-file_ff_differs(buf)
+file_ff_differs(buf, ignore_empty)
     buf_T	*buf;
+    int		ignore_empty;
 {
     /* In a buffer that was never loaded the options are not valid. */
     if (buf->b_flags & BF_NEVERLOADED)
 	return FALSE;
-    if ((buf->b_flags & BF_NEW)
+    if (ignore_empty
+	    && (buf->b_flags & BF_NEW)
 	    && buf->b_ml.ml_line_count == 1
 	    && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
 	return FALSE;