Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
2684:951641b8784d | 2685:862d920800b1 |
---|---|
11294 /* | 11294 /* |
11295 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value | 11295 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value |
11296 * from when editing started (save_file_ff() called). | 11296 * from when editing started (save_file_ff() called). |
11297 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was | 11297 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was |
11298 * changed and 'binary' is not set. | 11298 * changed and 'binary' is not set. |
11299 * Don't consider a new, empty buffer to be changed. | 11299 * When "ignore_empty" is true don't consider a new, empty buffer to be |
11300 * changed. | |
11300 */ | 11301 */ |
11301 int | 11302 int |
11302 file_ff_differs(buf) | 11303 file_ff_differs(buf, ignore_empty) |
11303 buf_T *buf; | 11304 buf_T *buf; |
11305 int ignore_empty; | |
11304 { | 11306 { |
11305 /* In a buffer that was never loaded the options are not valid. */ | 11307 /* In a buffer that was never loaded the options are not valid. */ |
11306 if (buf->b_flags & BF_NEVERLOADED) | 11308 if (buf->b_flags & BF_NEVERLOADED) |
11307 return FALSE; | 11309 return FALSE; |
11308 if ((buf->b_flags & BF_NEW) | 11310 if (ignore_empty |
11311 && (buf->b_flags & BF_NEW) | |
11309 && buf->b_ml.ml_line_count == 1 | 11312 && buf->b_ml.ml_line_count == 1 |
11310 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL) | 11313 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL) |
11311 return FALSE; | 11314 return FALSE; |
11312 if (buf->b_start_ffc != *buf->b_p_ff) | 11315 if (buf->b_start_ffc != *buf->b_p_ff) |
11313 return TRUE; | 11316 return TRUE; |