]>
Commit | Line | Data |
---|---|---|
c6060300 MT |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.507 | |
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.507 | |
11 | Problem: When exiting with unsaved changes, selecting an existing file in | |
12 | the file dialog, there is no dialog to ask whether the existing | |
13 | file should be overwritten. (Felipe G. Nievinski) | |
14 | Solution: Call check_overwrite() before writing. (Christian Brabandt) | |
15 | Files: src/ex_cmds.c, src/ex_cmds2.c, src/proto/ex_cmds.pro | |
16 | ||
17 | ||
18 | *** ../vim-7.3.506/src/ex_cmds.c 2012-04-25 16:50:44.000000000 +0200 | |
19 | --- src/ex_cmds.c 2012-04-25 17:19:53.000000000 +0200 | |
20 | *************** | |
21 | *** 25,31 **** | |
22 | static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing)); | |
23 | #endif | |
24 | ||
25 | - static int check_overwrite __ARGS((exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int other)); | |
26 | static int check_readonly __ARGS((int *forceit, buf_T *buf)); | |
27 | #ifdef FEAT_AUTOCMD | |
28 | static void delbuf_msg __ARGS((char_u *name)); | |
29 | --- 25,30 ---- | |
30 | *************** | |
31 | *** 2722,2728 **** | |
32 | * May set eap->forceit if a dialog says it's OK to overwrite. | |
33 | * Return OK if it's OK, FAIL if it is not. | |
34 | */ | |
35 | ! static int | |
36 | check_overwrite(eap, buf, fname, ffname, other) | |
37 | exarg_T *eap; | |
38 | buf_T *buf; | |
39 | --- 2721,2727 ---- | |
40 | * May set eap->forceit if a dialog says it's OK to overwrite. | |
41 | * Return OK if it's OK, FAIL if it is not. | |
42 | */ | |
43 | ! int | |
44 | check_overwrite(eap, buf, fname, ffname, other) | |
45 | exarg_T *eap; | |
46 | buf_T *buf; | |
47 | *** ../vim-7.3.506/src/ex_cmds2.c 2012-03-23 18:39:10.000000000 +0100 | |
48 | --- src/ex_cmds2.c 2012-04-25 17:24:37.000000000 +0200 | |
49 | *************** | |
50 | *** 1489,1494 **** | |
51 | --- 1489,1495 ---- | |
52 | char_u buff[DIALOG_MSG_SIZE]; | |
53 | int ret; | |
54 | buf_T *buf2; | |
55 | + exarg_T ea; | |
56 | ||
57 | dialog_msg(buff, _("Save changes to \"%s\"?"), | |
58 | (buf->b_fname != NULL) ? | |
59 | *************** | |
60 | *** 1498,1510 **** | |
61 | else | |
62 | ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1); | |
63 | ||
64 | if (ret == VIM_YES) | |
65 | { | |
66 | #ifdef FEAT_BROWSE | |
67 | /* May get file name, when there is none */ | |
68 | browse_save_fname(buf); | |
69 | #endif | |
70 | ! if (buf->b_fname != NULL) /* didn't hit Cancel */ | |
71 | (void)buf_write_all(buf, FALSE); | |
72 | } | |
73 | else if (ret == VIM_NO) | |
74 | --- 1499,1517 ---- | |
75 | else | |
76 | ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1); | |
77 | ||
78 | + /* Init ea pseudo-structure, this is needed for the check_overwrite() | |
79 | + * function. */ | |
80 | + ea.append = ea.forceit = FALSE; | |
81 | + | |
82 | if (ret == VIM_YES) | |
83 | { | |
84 | #ifdef FEAT_BROWSE | |
85 | /* May get file name, when there is none */ | |
86 | browse_save_fname(buf); | |
87 | #endif | |
88 | ! if (buf->b_fname != NULL && check_overwrite(&ea, buf, | |
89 | ! buf->b_fname, buf->b_ffname, FALSE) == OK) | |
90 | ! /* didn't hit Cancel */ | |
91 | (void)buf_write_all(buf, FALSE); | |
92 | } | |
93 | else if (ret == VIM_NO) | |
94 | *************** | |
95 | *** 1532,1538 **** | |
96 | /* May get file name, when there is none */ | |
97 | browse_save_fname(buf2); | |
98 | #endif | |
99 | ! if (buf2->b_fname != NULL) /* didn't hit Cancel */ | |
100 | (void)buf_write_all(buf2, FALSE); | |
101 | #ifdef FEAT_AUTOCMD | |
102 | /* an autocommand may have deleted the buffer */ | |
103 | --- 1539,1547 ---- | |
104 | /* May get file name, when there is none */ | |
105 | browse_save_fname(buf2); | |
106 | #endif | |
107 | ! if (buf2->b_fname != NULL && check_overwrite(&ea, buf2, | |
108 | ! buf2->b_fname, buf2->b_ffname, FALSE) == OK) | |
109 | ! /* didn't hit Cancel */ | |
110 | (void)buf_write_all(buf2, FALSE); | |
111 | #ifdef FEAT_AUTOCMD | |
112 | /* an autocommand may have deleted the buffer */ | |
113 | *** ../vim-7.3.506/src/proto/ex_cmds.pro 2010-08-15 21:57:28.000000000 +0200 | |
114 | --- src/proto/ex_cmds.pro 2012-04-25 17:25:47.000000000 +0200 | |
115 | *************** | |
116 | *** 23,28 **** | |
117 | --- 23,29 ---- | |
118 | void ex_update __ARGS((exarg_T *eap)); | |
119 | void ex_write __ARGS((exarg_T *eap)); | |
120 | int do_write __ARGS((exarg_T *eap)); | |
121 | + int check_overwrite __ARGS((exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int other)); | |
122 | void ex_wnext __ARGS((exarg_T *eap)); | |
123 | void do_wqall __ARGS((exarg_T *eap)); | |
124 | int not_writing __ARGS((void)); | |
125 | *** ../vim-7.3.506/src/version.c 2012-04-25 17:10:12.000000000 +0200 | |
126 | --- src/version.c 2012-04-25 17:17:30.000000000 +0200 | |
127 | *************** | |
128 | *** 716,717 **** | |
129 | --- 716,719 ---- | |
130 | { /* Add new patch number below this line */ | |
131 | + /**/ | |
132 | + 507, | |
133 | /**/ | |
134 | ||
135 | -- | |
136 | BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One. | |
137 | ANOTHER MONK: And St. Attila raised his hand grenade up on high saying "O | |
138 | Lord bless this thy hand grenade that with it thou mayest | |
139 | blow thine enemies to tiny bits, in thy mercy. "and the Lord | |
140 | did grin and people did feast upon the lambs and sloths and | |
141 | carp and anchovies and orang-utans and breakfast cereals and | |
142 | fruit bats and... | |
143 | BROTHER MAYNARD: Skip a bit brother ... | |
144 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
145 | ||
146 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
147 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
148 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
149 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |