1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2011-01-22 00:11:50 +01:00
parent d2c340a6a6
commit 164c60f5b1
6 changed files with 20 additions and 7 deletions

View File

@@ -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;