summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.3.507
blob: c96561c390d5742664a779ddbdaa933741560cee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
To: vim_dev@googlegroups.com
Subject: Patch 7.3.507
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.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)
Files:	    src/ex_cmds.c, src/ex_cmds2.c, src/proto/ex_cmds.pro


*** ../vim-7.3.506/src/ex_cmds.c	2012-04-25 16:50:44.000000000 +0200
--- src/ex_cmds.c	2012-04-25 17:19:53.000000000 +0200
***************
*** 25,31 ****
  static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
  #endif
  
- static int check_overwrite __ARGS((exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int other));
  static int check_readonly __ARGS((int *forceit, buf_T *buf));
  #ifdef FEAT_AUTOCMD
  static void delbuf_msg __ARGS((char_u *name));
--- 25,30 ----
***************
*** 2722,2728 ****
   * May set eap->forceit if a dialog says it's OK to overwrite.
   * Return OK if it's OK, FAIL if it is not.
   */
!     static int
  check_overwrite(eap, buf, fname, ffname, other)
      exarg_T	*eap;
      buf_T	*buf;
--- 2721,2727 ----
   * May set eap->forceit if a dialog says it's OK to overwrite.
   * Return OK if it's OK, FAIL if it is not.
   */
!     int
  check_overwrite(eap, buf, fname, ffname, other)
      exarg_T	*eap;
      buf_T	*buf;
*** ../vim-7.3.506/src/ex_cmds2.c	2012-03-23 18:39:10.000000000 +0100
--- src/ex_cmds2.c	2012-04-25 17:24:37.000000000 +0200
***************
*** 1489,1494 ****
--- 1489,1495 ----
      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,1510 ****
      else
  	ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1);
  
      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 */
  	    (void)buf_write_all(buf, FALSE);
      }
      else if (ret == VIM_NO)
--- 1499,1517 ----
      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 && 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,1538 ****
  		/* May get file name, when there is none */
  		browse_save_fname(buf2);
  #endif
! 		if (buf2->b_fname != NULL)   /* didn't hit Cancel */
  		    (void)buf_write_all(buf2, FALSE);
  #ifdef FEAT_AUTOCMD
  		/* an autocommand may have deleted the buffer */
--- 1539,1547 ----
  		/* May get file name, when there is none */
  		browse_save_fname(buf2);
  #endif
! 		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 */
*** ../vim-7.3.506/src/proto/ex_cmds.pro	2010-08-15 21:57:28.000000000 +0200
--- src/proto/ex_cmds.pro	2012-04-25 17:25:47.000000000 +0200
***************
*** 23,28 ****
--- 23,29 ----
  void ex_update __ARGS((exarg_T *eap));
  void ex_write __ARGS((exarg_T *eap));
  int do_write __ARGS((exarg_T *eap));
+ int check_overwrite __ARGS((exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int other));
  void ex_wnext __ARGS((exarg_T *eap));
  void do_wqall __ARGS((exarg_T *eap));
  int not_writing __ARGS((void));
*** ../vim-7.3.506/src/version.c	2012-04-25 17:10:12.000000000 +0200
--- src/version.c	2012-04-25 17:17:30.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     507,
  /**/

-- 
BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One.
ANOTHER MONK:    And St.  Attila raised his hand grenade up on high saying "O
                 Lord bless this thy hand grenade that with it thou mayest
                 blow thine enemies to tiny bits, in thy mercy. "and the Lord
                 did grin and people did feast upon the lambs and sloths and
                 carp and anchovies and orang-utans and breakfast cereals and
                 fruit bats and...
BROTHER MAYNARD: Skip a bit brother ...
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///