]> git.pld-linux.org Git - packages/vim.git/blame - 7.2.334
- use patch from ALTLinux
[packages/vim.git] / 7.2.334
CommitLineData
907f7fb0
ER
1To: vim-dev@vim.org
2Subject: Patch 7.2.334
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.2.334
11Problem: Postponing keys in Netbeans interface does not work properly.
12Solution: Store the key string instead of the number. Avoid an infinite
13 loop. (Mostly by Xavier de Gaye)
14Files: src/netbeans.c, src/proto/netbeans.pro
15
16
17*** ../vim-7.2.333/src/netbeans.c 2010-01-19 14:59:14.000000000 +0100
18--- src/netbeans.c 2010-01-19 15:12:17.000000000 +0100
19***************
20*** 70,76 ****
21 static pos_T *off2pos __ARGS((buf_T *, long));
22 static pos_T *get_off_or_lnum __ARGS((buf_T *buf, char_u **argp));
23 static long get_buf_size __ARGS((buf_T *));
24! static void netbeans_keystring __ARGS((int key, char *keystr));
25 static void special_keys __ARGS((char_u *args));
26
27 static void netbeans_connect __ARGS((void));
28--- 70,77 ----
29 static pos_T *off2pos __ARGS((buf_T *, long));
30 static pos_T *get_off_or_lnum __ARGS((buf_T *buf, char_u **argp));
31 static long get_buf_size __ARGS((buf_T *));
32! static int netbeans_keystring __ARGS((char_u *keystr));
33! static void postpone_keycommand __ARGS((char_u *keystr));
34 static void special_keys __ARGS((char_u *args));
35
36 static void netbeans_connect __ARGS((void));
37***************
38*** 502,508 ****
39
40 struct keyqueue
41 {
42! int key;
43 struct keyqueue *next;
44 struct keyqueue *prev;
45 };
46--- 503,509 ----
47
48 struct keyqueue
49 {
50! char_u *keystr;
51 struct keyqueue *next;
52 struct keyqueue *prev;
53 };
54***************
55*** 514,526 ****
56
57 /*
58 * Queue up key commands sent from netbeans.
59 */
60 static void
61! postpone_keycommand(int key)
62 {
63 keyQ_T *node;
64
65 node = (keyQ_T *)alloc(sizeof(keyQ_T));
66
67 if (keyHead.next == NULL) /* initialize circular queue */
68 {
69--- 515,531 ----
70
71 /*
72 * Queue up key commands sent from netbeans.
73+ * We store the string, because it may depend on the global mod_mask and
74+ * :nbkey doesn't have a key number.
75 */
76 static void
77! postpone_keycommand(char_u *keystr)
78 {
79 keyQ_T *node;
80
81 node = (keyQ_T *)alloc(sizeof(keyQ_T));
82+ if (node == NULL)
83+ return; /* out of memory, drop the key */
84
85 if (keyHead.next == NULL) /* initialize circular queue */
86 {
87***************
88*** 534,540 ****
89 keyHead.prev->next = node;
90 keyHead.prev = node;
91
92! node->key = key;
93 }
94
95 /*
96--- 539,545 ----
97 keyHead.prev->next = node;
98 keyHead.prev = node;
99
100! node->keystr = vim_strsave(keystr);
101 }
102
103 /*
104***************
105*** 543,557 ****
106 static void
107 handle_key_queue(void)
108 {
109! while (keyHead.next && keyHead.next != &keyHead)
110 {
111 /* first, unlink the node */
112 keyQ_T *node = keyHead.next;
113 keyHead.next = node->next;
114 node->next->prev = node->prev;
115
116! /* now, send the keycommand */
117! netbeans_keycommand(node->key);
118
119 /* Finally, dispose of the node */
120 vim_free(node);
121--- 548,567 ----
122 static void
123 handle_key_queue(void)
124 {
125! int postponed = FALSE;
126!
127! while (!postponed && keyHead.next && keyHead.next != &keyHead)
128 {
129 /* first, unlink the node */
130 keyQ_T *node = keyHead.next;
131 keyHead.next = node->next;
132 node->next->prev = node->prev;
133
134! /* Now, send the keycommand. This may cause it to be postponed again
135! * and change keyHead. */
136! if (node->keystr != NULL)
137! postponed = !netbeans_keystring(node->keystr);
138! vim_free(node->keystr);
139
140 /* Finally, dispose of the node */
141 vim_free(node);
142***************
143*** 2495,2501 ****
144 }
145 else
146 {
147! nbdebug((" Buffer has no changes!\n"));
148 }
149 /* =====================================================================*/
150 }
151--- 2505,2511 ----
152 }
153 else
154 {
155! nbdebug((" Buffer has no changes!\n"));
156 }
157 /* =====================================================================*/
158 }
159***************
160*** 2658,2664 ****
161 ex_nbkey(eap)
162 exarg_T *eap;
163 {
164! netbeans_keystring(0, (char *)eap->arg);
165 }
166
167
168--- 2668,2674 ----
169 ex_nbkey(eap)
170 exarg_T *eap;
171 {
172! (void)netbeans_keystring(eap->arg);
173 }
174
175
176***************
177*** 2680,2686 ****
178 }
179
180 /*
181! * Convert key to netbeans name.
182 */
183 static void
184 netbeans_keyname(int key, char *buf)
185--- 2690,2696 ----
186 }
187
188 /*
189! * Convert key to netbeans name. This uses the global "mod_mask".
190 */
191 static void
192 netbeans_keyname(int key, char *buf)
193***************
194*** 3127,3149 ****
195 /*
196 * Send a keypress event back to netbeans. This usually simulates some
197 * kind of function key press. This function operates on a key code.
198 */
199! void
200 netbeans_keycommand(int key)
201 {
202 char keyName[60];
203
204 netbeans_keyname(key, keyName);
205! netbeans_keystring(key, keyName);
206 }
207
208
209 /*
210 * Send a keypress event back to netbeans. This usually simulates some
211 * kind of function key press. This function operates on a key string.
212 */
213! static void
214! netbeans_keystring(int key, char *keyName)
215 {
216 char buf[2*MAXPATHL];
217 int bufno = nb_getbufno(curbuf);
218--- 3137,3163 ----
219 /*
220 * Send a keypress event back to netbeans. This usually simulates some
221 * kind of function key press. This function operates on a key code.
222+ * Return TRUE when the key was sent, FALSE when the command has been
223+ * postponed.
224 */
225! int
226 netbeans_keycommand(int key)
227 {
228 char keyName[60];
229
230 netbeans_keyname(key, keyName);
231! return netbeans_keystring((char_u *)keyName);
232 }
233
234
235 /*
236 * Send a keypress event back to netbeans. This usually simulates some
237 * kind of function key press. This function operates on a key string.
238+ * Return TRUE when the key was sent, FALSE when the command has been
239+ * postponed.
240 */
241! static int
242! netbeans_keystring(char_u *keyName)
243 {
244 char buf[2*MAXPATHL];
245 int bufno = nb_getbufno(curbuf);
246***************
247*** 3151,3157 ****
248 char_u *q;
249
250 if (!haveConnection)
251! return;
252
253
254 if (bufno == -1)
255--- 3165,3171 ----
256 char_u *q;
257
258 if (!haveConnection)
259! return TRUE;
260
261
262 if (bufno == -1)
263***************
264*** 3160,3166 ****
265 q = curbuf->b_ffname == NULL ? (char_u *)""
266 : nb_quote(curbuf->b_ffname);
267 if (q == NULL)
268! return;
269 vim_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0,
270 q,
271 "T", /* open in NetBeans */
272--- 3174,3180 ----
273 q = curbuf->b_ffname == NULL ? (char_u *)""
274 : nb_quote(curbuf->b_ffname);
275 if (q == NULL)
276! return TRUE;
277 vim_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0,
278 q,
279 "T", /* open in NetBeans */
280***************
281*** 3170,3178 ****
282 nbdebug(("EVT: %s", buf));
283 nb_send(buf, "netbeans_keycommand");
284
285! if (key > 0)
286! postpone_keycommand(key);
287! return;
288 }
289
290 /* sync the cursor position */
291--- 3184,3191 ----
292 nbdebug(("EVT: %s", buf));
293 nb_send(buf, "netbeans_keycommand");
294
295! postpone_keycommand(keyName);
296! return FALSE;
297 }
298
299 /* sync the cursor position */
300***************
301*** 3198,3203 ****
302--- 3211,3217 ----
303 off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col);
304 nbdebug(("EVT: %s", buf));
305 nb_send(buf, "netbeans_keycommand");
306+ return TRUE;
307 }
308
309
310*** ../vim-7.2.333/src/proto/netbeans.pro 2009-01-06 16:13:42.000000000 +0100
311--- src/proto/netbeans.pro 2010-01-19 13:31:01.000000000 +0100
312***************
313*** 16,22 ****
314 void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
315 void netbeans_unmodified __ARGS((buf_T *bufp));
316 void netbeans_button_release __ARGS((int button));
317! void netbeans_keycommand __ARGS((int key));
318 void netbeans_save_buffer __ARGS((buf_T *bufp));
319 void netbeans_deleted_all_lines __ARGS((buf_T *bufp));
320 int netbeans_is_guarded __ARGS((linenr_T top, linenr_T bot));
321--- 16,22 ----
322 void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
323 void netbeans_unmodified __ARGS((buf_T *bufp));
324 void netbeans_button_release __ARGS((int button));
325! int netbeans_keycommand __ARGS((int key));
326 void netbeans_save_buffer __ARGS((buf_T *bufp));
327 void netbeans_deleted_all_lines __ARGS((buf_T *bufp));
328 int netbeans_is_guarded __ARGS((linenr_T top, linenr_T bot));
329*** ../vim-7.2.333/src/version.c 2010-01-19 14:59:14.000000000 +0100
330--- src/version.c 2010-01-19 15:08:44.000000000 +0100
331***************
332*** 683,684 ****
333--- 683,686 ----
334 { /* Add new patch number below this line */
335+ /**/
336+ 334,
337 /**/
338
339--
340hundred-and-one symptoms of being an internet addict:
341119. You are reading a book and look for the scroll bar to get to
342 the next page.
343
344 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
345/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
346\\\ download, build and distribute -- http://www.A-A-P.org ///
347 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
This page took 0.111148 seconds and 4 git commands to generate.