]> git.pld-linux.org Git - packages/vim.git/blob - 7.0.022
- new
[packages/vim.git] / 7.0.022
1 To: vim-dev@vim.org
2 Subject: Patch 7.0.022
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.022
11 Problem:    Using buffer.append() in Ruby may append the line to the wrong
12             buffer. (Alex Norman)
13 Solution:   Properly switch to the buffer to do the appending.  Also for
14             buffer.delete() and setting a buffer line.
15 Files:      src/if_ruby.c
16
17
18 *** ../vim-7.0.021/src/if_ruby.c        Sun Apr 30 20:25:42 2006
19 --- src/if_ruby.c       Tue Jun 20 21:01:23 2006
20 ***************
21 *** 643,653 ****
22   
23   static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
24   {
25 !     buf_T *savebuf = curbuf;
26 !     char *line = STR2CSTR(str);
27   
28 !     if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL) {
29         curbuf = buf;
30         if (u_savesub(n) == OK) {
31             ml_replace(n, (char_u *)line, TRUE);
32             changed();
33 --- 643,665 ----
34   
35   static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
36   {
37 !     char      *line = STR2CSTR(str);
38 ! #ifdef FEAT_AUTOCMD
39 !     aco_save_T        aco;
40 ! #else
41 !     buf_T     *save_curbuf = curbuf;
42 ! #endif
43   
44 !     if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
45 !     {
46 ! #ifdef FEAT_AUTOCMD
47 !       /* set curwin/curbuf for "buf" and save some things */
48 !       aucmd_prepbuf(&aco, buf);
49 ! #else
50         curbuf = buf;
51 +       curwin->w_buffer = buf;
52 + #endif
53
54         if (u_savesub(n) == OK) {
55             ml_replace(n, (char_u *)line, TRUE);
56             changed();
57 ***************
58 *** 655,664 ****
59             syn_changed(n); /* recompute syntax hl. for this line */
60   #endif
61         }
62 !       curbuf = savebuf;
63         update_curbuf(NOT_VALID);
64       }
65 !     else {
66         rb_raise(rb_eIndexError, "index %d out of buffer", n);
67         return Qnil; /* For stop warning */
68       }
69 --- 667,685 ----
70             syn_changed(n); /* recompute syntax hl. for this line */
71   #endif
72         }
73
74 ! #ifdef FEAT_AUTOCMD
75 !       /* restore curwin/curbuf and a few other things */
76 !       aucmd_restbuf(&aco);
77 !       /* Careful: autocommands may have made "buf" invalid! */
78 ! #else
79 !       curwin->w_buffer = save_curbuf;
80 !       curbuf = save_curbuf;
81 ! #endif
82         update_curbuf(NOT_VALID);
83       }
84 !     else
85 !     {
86         rb_raise(rb_eIndexError, "index %d out of buffer", n);
87         return Qnil; /* For stop warning */
88       }
89 ***************
90 *** 676,687 ****
91   
92   static VALUE buffer_delete(VALUE self, VALUE num)
93   {
94 !     buf_T *buf = get_buf(self);
95 !     buf_T *savebuf = curbuf;
96 !     long n = NUM2LONG(num);
97   
98 !     if (n > 0 && n <= buf->b_ml.ml_line_count) {
99         curbuf = buf;
100         if (u_savedel(n, 1) == OK) {
101             ml_delete(n, 0);
102   
103 --- 697,720 ----
104   
105   static VALUE buffer_delete(VALUE self, VALUE num)
106   {
107 !     buf_T     *buf = get_buf(self);
108 !     long      n = NUM2LONG(num);
109 ! #ifdef FEAT_AUTOCMD
110 !     aco_save_T        aco;
111 ! #else
112 !     buf_T     *save_curbuf = curbuf;
113 ! #endif
114   
115 !     if (n > 0 && n <= buf->b_ml.ml_line_count)
116 !     {
117 ! #ifdef FEAT_AUTOCMD
118 !       /* set curwin/curbuf for "buf" and save some things */
119 !       aucmd_prepbuf(&aco, buf);
120 ! #else
121         curbuf = buf;
122 +       curwin->w_buffer = buf;
123 + #endif
124
125         if (u_savedel(n, 1) == OK) {
126             ml_delete(n, 0);
127   
128 ***************
129 *** 691,700 ****
130   
131             changed();
132         }
133 !       curbuf = savebuf;
134         update_curbuf(NOT_VALID);
135       }
136 !     else {
137         rb_raise(rb_eIndexError, "index %d out of buffer", n);
138       }
139       return Qnil;
140 --- 724,742 ----
141   
142             changed();
143         }
144
145 ! #ifdef FEAT_AUTOCMD
146 !       /* restore curwin/curbuf and a few other things */
147 !       aucmd_restbuf(&aco);
148 !       /* Careful: autocommands may have made "buf" invalid! */
149 ! #else
150 !       curwin->w_buffer = save_curbuf;
151 !       curbuf = save_curbuf;
152 ! #endif
153         update_curbuf(NOT_VALID);
154       }
155 !     else
156 !     {
157         rb_raise(rb_eIndexError, "index %d out of buffer", n);
158       }
159       return Qnil;
160 ***************
161 *** 702,714 ****
162   
163   static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
164   {
165 !     buf_T *buf = get_buf(self);
166 !     buf_T *savebuf = curbuf;
167 !     char *line = STR2CSTR(str);
168 !     long n = NUM2LONG(num);
169   
170 !     if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL) {
171         curbuf = buf;
172         if (u_inssub(n + 1) == OK) {
173             ml_append(n, (char_u *) line, (colnr_T) 0, FALSE);
174   
175 --- 744,768 ----
176   
177   static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
178   {
179 !     buf_T     *buf = get_buf(self);
180 !     char      *line = STR2CSTR(str);
181 !     long      n = NUM2LONG(num);
182 ! #ifdef FEAT_AUTOCMD
183 !     aco_save_T        aco;
184 ! #else
185 !     buf_T     *save_curbuf = curbuf;
186 ! #endif
187   
188 !     if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL)
189 !     {
190 ! #ifdef FEAT_AUTOCMD
191 !       /* set curwin/curbuf for "buf" and save some things */
192 !       aucmd_prepbuf(&aco, buf);
193 ! #else
194         curbuf = buf;
195 +       curwin->w_buffer = buf;
196 + #endif
197
198         if (u_inssub(n + 1) == OK) {
199             ml_append(n, (char_u *) line, (colnr_T) 0, FALSE);
200   
201 ***************
202 *** 718,724 ****
203   
204             changed();
205         }
206 !       curbuf = savebuf;
207         update_curbuf(NOT_VALID);
208       }
209       else {
210 --- 772,786 ----
211   
212             changed();
213         }
214
215 ! #ifdef FEAT_AUTOCMD
216 !       /* restore curwin/curbuf and a few other things */
217 !       aucmd_restbuf(&aco);
218 !       /* Careful: autocommands may have made "buf" invalid! */
219 ! #else
220 !       curwin->w_buffer = save_curbuf;
221 !       curbuf = save_curbuf;
222 ! #endif
223         update_curbuf(NOT_VALID);
224       }
225       else {
226 *** ../vim-7.0.021/src/version.c        Tue Jun 20 20:49:42 2006
227 --- src/version.c       Tue Jun 20 18:42:35 2006
228 ***************
229 *** 668,669 ****
230 --- 668,671 ----
231   {   /* Add new patch number below this line */
232 + /**/
233 +     22,
234   /**/
This page took 0.038893 seconds and 3 git commands to generate.