summaryrefslogtreecommitdiff
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-04-25 17:32:18 +0200
committerBram Moolenaar <Bram@vim.org>2012-04-25 17:32:18 +0200
commit8218f60b610a004c17a5f74bcc6a1187f6fc4e75 (patch)
tree73490cab27209c860b7d98f15ef44a42dad65767 /src/ex_cmds2.c
parent68fb5dcd1314e371df1b1ee24d99fab776711a65 (diff)
downloadvim-git-8218f60b610a004c17a5f74bcc6a1187f6fc4e75.tar.gz
updated for version 7.3.507v7.3.507
Problem: When exiting with unsaved changes, selecting an existing file in the file dialog, there is no dialog to ask whether the existing file should be overwritten. (Felipe G. Nievinski) Solution: Call check_overwrite() before writing. (Christian Brabandt)
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 2bce6dfdc..611a36339 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1489,6 +1489,7 @@ dialog_changed(buf, checkall)
char_u buff[DIALOG_MSG_SIZE];
int ret;
buf_T *buf2;
+ exarg_T ea;
dialog_msg(buff, _("Save changes to \"%s\"?"),
(buf->b_fname != NULL) ?
@@ -1498,13 +1499,19 @@ dialog_changed(buf, checkall)
else
ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1);
+ /* Init ea pseudo-structure, this is needed for the check_overwrite()
+ * function. */
+ ea.append = ea.forceit = FALSE;
+
if (ret == VIM_YES)
{
#ifdef FEAT_BROWSE
/* May get file name, when there is none */
browse_save_fname(buf);
#endif
- if (buf->b_fname != NULL) /* didn't hit Cancel */
+ if (buf->b_fname != NULL && check_overwrite(&ea, buf,
+ buf->b_fname, buf->b_ffname, FALSE) == OK)
+ /* didn't hit Cancel */
(void)buf_write_all(buf, FALSE);
}
else if (ret == VIM_NO)
@@ -1532,7 +1539,9 @@ dialog_changed(buf, checkall)
/* May get file name, when there is none */
browse_save_fname(buf2);
#endif
- if (buf2->b_fname != NULL) /* didn't hit Cancel */
+ if (buf2->b_fname != NULL && check_overwrite(&ea, buf2,
+ buf2->b_fname, buf2->b_ffname, FALSE) == OK)
+ /* didn't hit Cancel */
(void)buf_write_all(buf2, FALSE);
#ifdef FEAT_AUTOCMD
/* an autocommand may have deleted the buffer */