1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Changing 'fileformat' and then using ":w" in an empty file sets
12 the 'modified' option.
13 Solution: In unchanged() don't ignore 'ff' for an empty file.
14 Files: src/misc1.c, src/option.c, src/proto/option.pro, src/undo.c
17 *** ../vim-7.3.102/src/misc1.c 2010-12-30 12:30:26.000000000 +0100
18 --- src/misc1.c 2011-01-22 00:00:24.000000000 +0100
22 int ff; /* also reset 'fileformat' */
24 ! if (buf->b_changed || (ff && file_ff_differs(buf)))
30 int ff; /* also reset 'fileformat' */
32 ! if (buf->b_changed || (ff && file_ff_differs(buf, FALSE)))
36 *** ../vim-7.3.102/src/option.c 2010-12-02 21:43:10.000000000 +0100
37 --- src/option.c 2011-01-22 00:03:40.000000000 +0100
40 * from when editing started (save_file_ff() called).
41 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
42 * changed and 'binary' is not set.
43 ! * Don't consider a new, empty buffer to be changed.
46 ! file_ff_differs(buf)
49 /* In a buffer that was never loaded the options are not valid. */
50 if (buf->b_flags & BF_NEVERLOADED)
52 ! if ((buf->b_flags & BF_NEW)
53 && buf->b_ml.ml_line_count == 1
54 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
57 * from when editing started (save_file_ff() called).
58 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
59 * changed and 'binary' is not set.
60 ! * When "ignore_empty" is true don't consider a new, empty buffer to be
64 ! file_ff_differs(buf, ignore_empty)
68 /* In a buffer that was never loaded the options are not valid. */
69 if (buf->b_flags & BF_NEVERLOADED)
72 ! && (buf->b_flags & BF_NEW)
73 && buf->b_ml.ml_line_count == 1
74 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
76 *** ../vim-7.3.102/src/proto/option.pro 2010-08-15 21:57:28.000000000 +0200
77 --- src/proto/option.pro 2011-01-22 00:04:35.000000000 +0100
80 int option_was_set __ARGS((char_u *name));
81 int can_bs __ARGS((int what));
82 void save_file_ff __ARGS((buf_T *buf));
83 ! int file_ff_differs __ARGS((buf_T *buf));
84 int check_ff_value __ARGS((char_u *p));
87 int option_was_set __ARGS((char_u *name));
88 int can_bs __ARGS((int what));
89 void save_file_ff __ARGS((buf_T *buf));
90 ! int file_ff_differs __ARGS((buf_T *buf, int ignore_empty));
91 int check_ff_value __ARGS((char_u *p));
93 *** ../vim-7.3.102/src/undo.c 2010-12-17 18:06:00.000000000 +0100
94 --- src/undo.c 2011-01-22 00:03:58.000000000 +0100
100 ! (buf->b_changed || file_ff_differs(buf));
106 !bt_dontwrite(buf) &&
108 ! (buf->b_changed || file_ff_differs(buf, TRUE));
115 !bt_dontwrite(curbuf) &&
117 ! (curbuf->b_changed || file_ff_differs(curbuf));
120 #if defined(FEAT_EVAL) || defined(PROTO)
123 !bt_dontwrite(curbuf) &&
125 ! (curbuf->b_changed || file_ff_differs(curbuf, TRUE));
128 #if defined(FEAT_EVAL) || defined(PROTO)
129 *** ../vim-7.3.102/src/version.c 2011-01-17 20:08:03.000000000 +0100
130 --- src/version.c 2011-01-22 00:07:56.000000000 +0100
134 { /* Add new patch number below this line */
140 In a world without fences, who needs Gates and Windows?
142 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
143 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
144 \\\ an exciting new programming language -- http://www.Zimbu.org ///
145 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///