]>
Commit | Line | Data |
---|---|---|
9b1d76b7 AG |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.0.195 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.0.195 | |
11 | Problem: When a buffer is modified and 'autowriteall' is set, ":quit" | |
12 | results in an endless loop when there is a conversion error while | |
13 | writing. (Nikolai Weibull) | |
14 | Solution: Make autowrite() return FAIL if the buffer is still changed after | |
15 | writing it. | |
16 | Files: src/ex_cmds2.c | |
17 | ||
18 | ||
19 | *** ../vim-7.0.194/src/ex_cmds2.c Tue Jan 16 21:31:38 2007 | |
20 | --- src/ex_cmds2.c Tue Feb 13 06:11:28 2007 | |
21 | *************** | |
22 | *** 1242,1255 **** | |
23 | buf_T *buf; | |
24 | int forceit; | |
25 | { | |
26 | if (!(p_aw || p_awa) || !p_write | |
27 | #ifdef FEAT_QUICKFIX | |
28 | ! /* never autowrite a "nofile" or "nowrite" buffer */ | |
29 | ! || bt_dontwrite(buf) | |
30 | #endif | |
31 | ! || (!forceit && buf->b_p_ro) || buf->b_ffname == NULL) | |
32 | return FAIL; | |
33 | ! return buf_write_all(buf, forceit); | |
34 | } | |
35 | ||
36 | /* | |
37 | --- 1242,1263 ---- | |
38 | buf_T *buf; | |
39 | int forceit; | |
40 | { | |
41 | + int r; | |
42 | + | |
43 | if (!(p_aw || p_awa) || !p_write | |
44 | #ifdef FEAT_QUICKFIX | |
45 | ! /* never autowrite a "nofile" or "nowrite" buffer */ | |
46 | ! || bt_dontwrite(buf) | |
47 | #endif | |
48 | ! || (!forceit && buf->b_p_ro) || buf->b_ffname == NULL) | |
49 | return FAIL; | |
50 | ! r = buf_write_all(buf, forceit); | |
51 | ! | |
52 | ! /* Writing may succeed but the buffer still changed, e.g., when there is a | |
53 | ! * conversion error. We do want to return FAIL then. */ | |
54 | ! if (buf_valid(buf) && bufIsChanged(buf)) | |
55 | ! r = FAIL; | |
56 | ! return r; | |
57 | } | |
58 | ||
59 | /* | |
60 | *************** | |
61 | *** 1472,1477 **** | |
62 | --- 1480,1487 ---- | |
63 | if (buf == NULL) /* No buffers changed */ | |
64 | return FALSE; | |
65 | ||
66 | + /* Try auto-writing the buffer. If this fails but the buffer no | |
67 | + * longer exists it's not changed, that's OK. */ | |
68 | if (check_changed(buf, p_awa, TRUE, FALSE, TRUE) && buf_valid(buf)) | |
69 | break; /* didn't save - still changes */ | |
70 | } | |
71 | *** ../vim-7.0.194/src/version.c Tue Feb 13 04:03:05 2007 | |
72 | --- src/version.c Tue Feb 13 06:18:28 2007 | |
73 | *************** | |
74 | *** 668,669 **** | |
75 | --- 668,671 ---- | |
76 | { /* Add new patch number below this line */ | |
77 | + /**/ | |
78 | + 195, | |
79 | /**/ | |
80 | ||
81 | -- | |
82 | hundred-and-one symptoms of being an internet addict: | |
83 | 115. You are late picking up your kid from school and try to explain | |
84 | to the teacher you were stuck in Web traffic. | |
85 | ||
86 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
87 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
88 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
89 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |