]>
Commit | Line | Data |
---|---|---|
0611be5f ER |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.103 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.103 | |
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 | |
15 | ||
16 | ||
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 | |
19 | *************** | |
20 | *** 2919,2925 **** | |
21 | buf_T *buf; | |
22 | int ff; /* also reset 'fileformat' */ | |
23 | { | |
24 | ! if (buf->b_changed || (ff && file_ff_differs(buf))) | |
25 | { | |
26 | buf->b_changed = 0; | |
27 | ml_setflags(buf); | |
28 | --- 2919,2925 ---- | |
29 | buf_T *buf; | |
30 | int ff; /* also reset 'fileformat' */ | |
31 | { | |
32 | ! if (buf->b_changed || (ff && file_ff_differs(buf, FALSE))) | |
33 | { | |
34 | buf->b_changed = 0; | |
35 | ml_setflags(buf); | |
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 | |
38 | *************** | |
39 | *** 11296,11311 **** | |
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. | |
44 | */ | |
45 | int | |
46 | ! file_ff_differs(buf) | |
47 | buf_T *buf; | |
48 | { | |
49 | /* In a buffer that was never loaded the options are not valid. */ | |
50 | if (buf->b_flags & BF_NEVERLOADED) | |
51 | return FALSE; | |
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) | |
55 | return FALSE; | |
56 | --- 11296,11314 ---- | |
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 | |
61 | ! * changed. | |
62 | */ | |
63 | int | |
64 | ! file_ff_differs(buf, ignore_empty) | |
65 | buf_T *buf; | |
66 | + int ignore_empty; | |
67 | { | |
68 | /* In a buffer that was never loaded the options are not valid. */ | |
69 | if (buf->b_flags & BF_NEVERLOADED) | |
70 | return FALSE; | |
71 | ! if (ignore_empty | |
72 | ! && (buf->b_flags & BF_NEW) | |
73 | && buf->b_ml.ml_line_count == 1 | |
74 | && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL) | |
75 | return FALSE; | |
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 | |
78 | *************** | |
79 | *** 54,59 **** | |
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)); | |
85 | /* vim: set ft=c : */ | |
86 | --- 54,59 ---- | |
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)); | |
92 | /* vim: set ft=c : */ | |
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 | |
95 | *************** | |
96 | *** 3304,3310 **** | |
97 | #ifdef FEAT_QUICKFIX | |
98 | !bt_dontwrite(buf) && | |
99 | #endif | |
100 | ! (buf->b_changed || file_ff_differs(buf)); | |
101 | } | |
102 | ||
103 | int | |
104 | --- 3304,3310 ---- | |
105 | #ifdef FEAT_QUICKFIX | |
106 | !bt_dontwrite(buf) && | |
107 | #endif | |
108 | ! (buf->b_changed || file_ff_differs(buf, TRUE)); | |
109 | } | |
110 | ||
111 | int | |
112 | *************** | |
113 | *** 3314,3320 **** | |
114 | #ifdef FEAT_QUICKFIX | |
115 | !bt_dontwrite(curbuf) && | |
116 | #endif | |
117 | ! (curbuf->b_changed || file_ff_differs(curbuf)); | |
118 | } | |
119 | ||
120 | #if defined(FEAT_EVAL) || defined(PROTO) | |
121 | --- 3314,3320 ---- | |
122 | #ifdef FEAT_QUICKFIX | |
123 | !bt_dontwrite(curbuf) && | |
124 | #endif | |
125 | ! (curbuf->b_changed || file_ff_differs(curbuf, TRUE)); | |
126 | } | |
127 | ||
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 | |
131 | *************** | |
132 | *** 716,717 **** | |
133 | --- 716,719 ---- | |
134 | { /* Add new patch number below this line */ | |
135 | + /**/ | |
136 | + 103, | |
137 | /**/ | |
138 | ||
139 | -- | |
140 | In a world without fences, who needs Gates and Windows? | |
141 | ||
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 /// |