]>
Commit | Line | Data |
---|---|---|
0a7814d6 AG |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.089 | |
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.1.089 | |
11 | Problem: ":let loaded_getscriptPlugin" doesn't clear to eol, result is | |
12 | "#1in". | |
13 | Solution: Clear to the end of the screen after displaying the first variable | |
14 | value. | |
15 | Files: src/eval.c | |
16 | ||
17 | ||
18 | *** ../vim-7.1.088/src/eval.c Tue Aug 14 22:40:13 2007 | |
19 | --- src/eval.c Wed Aug 29 22:40:15 2007 | |
20 | *************** | |
21 | *** 369,385 **** | |
22 | static int ex_let_vars __ARGS((char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars)); | |
23 | static char_u *skip_var_list __ARGS((char_u *arg, int *var_count, int *semicolon)); | |
24 | static char_u *skip_var_one __ARGS((char_u *arg)); | |
25 | ! static void list_hashtable_vars __ARGS((hashtab_T *ht, char_u *prefix, int empty)); | |
26 | ! static void list_glob_vars __ARGS((void)); | |
27 | ! static void list_buf_vars __ARGS((void)); | |
28 | ! static void list_win_vars __ARGS((void)); | |
29 | #ifdef FEAT_WINDOWS | |
30 | ! static void list_tab_vars __ARGS((void)); | |
31 | #endif | |
32 | ! static void list_vim_vars __ARGS((void)); | |
33 | ! static void list_script_vars __ARGS((void)); | |
34 | ! static void list_func_vars __ARGS((void)); | |
35 | ! static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg)); | |
36 | static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op)); | |
37 | static int check_changedtick __ARGS((char_u *arg)); | |
38 | static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int quiet, int fne_flags)); | |
39 | --- 369,385 ---- | |
40 | static int ex_let_vars __ARGS((char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars)); | |
41 | static char_u *skip_var_list __ARGS((char_u *arg, int *var_count, int *semicolon)); | |
42 | static char_u *skip_var_one __ARGS((char_u *arg)); | |
43 | ! static void list_hashtable_vars __ARGS((hashtab_T *ht, char_u *prefix, int empty, int *first)); | |
44 | ! static void list_glob_vars __ARGS((int *first)); | |
45 | ! static void list_buf_vars __ARGS((int *first)); | |
46 | ! static void list_win_vars __ARGS((int *first)); | |
47 | #ifdef FEAT_WINDOWS | |
48 | ! static void list_tab_vars __ARGS((int *first)); | |
49 | #endif | |
50 | ! static void list_vim_vars __ARGS((int *first)); | |
51 | ! static void list_script_vars __ARGS((int *first)); | |
52 | ! static void list_func_vars __ARGS((int *first)); | |
53 | ! static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg, int *first)); | |
54 | static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op)); | |
55 | static int check_changedtick __ARGS((char_u *arg)); | |
56 | static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int quiet, int fne_flags)); | |
57 | *************** | |
58 | *** 704,711 **** | |
59 | static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname)); | |
60 | static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val)); | |
61 | static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi)); | |
62 | ! static void list_one_var __ARGS((dictitem_T *v, char_u *prefix)); | |
63 | ! static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string)); | |
64 | static void set_var __ARGS((char_u *name, typval_T *varp, int copy)); | |
65 | static int var_check_ro __ARGS((int flags, char_u *name)); | |
66 | static int var_check_fixed __ARGS((int flags, char_u *name)); | |
67 | --- 704,711 ---- | |
68 | static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname)); | |
69 | static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val)); | |
70 | static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi)); | |
71 | ! static void list_one_var __ARGS((dictitem_T *v, char_u *prefix, int *first)); | |
72 | ! static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string, int *first)); | |
73 | static void set_var __ARGS((char_u *name, typval_T *varp, int copy)); | |
74 | static int var_check_ro __ARGS((int flags, char_u *name)); | |
75 | static int var_check_fixed __ARGS((int flags, char_u *name)); | |
76 | *************** | |
77 | *** 1699,1704 **** | |
78 | --- 1699,1705 ---- | |
79 | int semicolon = 0; | |
80 | char_u op[2]; | |
81 | char_u *argend; | |
82 | + int first = TRUE; | |
83 | ||
84 | argend = skip_var_list(arg, &var_count, &semicolon); | |
85 | if (argend == NULL) | |
86 | *************** | |
87 | *** 1715,1733 **** | |
88 | EMSG(_(e_invarg)); | |
89 | else if (!ends_excmd(*arg)) | |
90 | /* ":let var1 var2" */ | |
91 | ! arg = list_arg_vars(eap, arg); | |
92 | else if (!eap->skip) | |
93 | { | |
94 | /* ":let" */ | |
95 | ! list_glob_vars(); | |
96 | ! list_buf_vars(); | |
97 | ! list_win_vars(); | |
98 | #ifdef FEAT_WINDOWS | |
99 | ! list_tab_vars(); | |
100 | #endif | |
101 | ! list_script_vars(); | |
102 | ! list_func_vars(); | |
103 | ! list_vim_vars(); | |
104 | } | |
105 | eap->nextcmd = check_nextcmd(arg); | |
106 | } | |
107 | --- 1716,1734 ---- | |
108 | EMSG(_(e_invarg)); | |
109 | else if (!ends_excmd(*arg)) | |
110 | /* ":let var1 var2" */ | |
111 | ! arg = list_arg_vars(eap, arg, &first); | |
112 | else if (!eap->skip) | |
113 | { | |
114 | /* ":let" */ | |
115 | ! list_glob_vars(&first); | |
116 | ! list_buf_vars(&first); | |
117 | ! list_win_vars(&first); | |
118 | #ifdef FEAT_WINDOWS | |
119 | ! list_tab_vars(&first); | |
120 | #endif | |
121 | ! list_script_vars(&first); | |
122 | ! list_func_vars(&first); | |
123 | ! list_vim_vars(&first); | |
124 | } | |
125 | eap->nextcmd = check_nextcmd(arg); | |
126 | } | |
127 | *************** | |
128 | *** 1932,1941 **** | |
129 | * If "empty" is TRUE also list NULL strings as empty strings. | |
130 | */ | |
131 | static void | |
132 | ! list_hashtable_vars(ht, prefix, empty) | |
133 | hashtab_T *ht; | |
134 | char_u *prefix; | |
135 | int empty; | |
136 | { | |
137 | hashitem_T *hi; | |
138 | dictitem_T *di; | |
139 | --- 1933,1943 ---- | |
140 | * If "empty" is TRUE also list NULL strings as empty strings. | |
141 | */ | |
142 | static void | |
143 | ! list_hashtable_vars(ht, prefix, empty, first) | |
144 | hashtab_T *ht; | |
145 | char_u *prefix; | |
146 | int empty; | |
147 | + int *first; | |
148 | { | |
149 | hashitem_T *hi; | |
150 | dictitem_T *di; | |
151 | *************** | |
152 | *** 1950,1956 **** | |
153 | di = HI2DI(hi); | |
154 | if (empty || di->di_tv.v_type != VAR_STRING | |
155 | || di->di_tv.vval.v_string != NULL) | |
156 | ! list_one_var(di, prefix); | |
157 | } | |
158 | } | |
159 | } | |
160 | --- 1952,1958 ---- | |
161 | di = HI2DI(hi); | |
162 | if (empty || di->di_tv.v_type != VAR_STRING | |
163 | || di->di_tv.vval.v_string != NULL) | |
164 | ! list_one_var(di, prefix, first); | |
165 | } | |
166 | } | |
167 | } | |
168 | *************** | |
169 | *** 1959,1990 **** | |
170 | * List global variables. | |
171 | */ | |
172 | static void | |
173 | ! list_glob_vars() | |
174 | { | |
175 | ! list_hashtable_vars(&globvarht, (char_u *)"", TRUE); | |
176 | } | |
177 | ||
178 | /* | |
179 | * List buffer variables. | |
180 | */ | |
181 | static void | |
182 | ! list_buf_vars() | |
183 | { | |
184 | char_u numbuf[NUMBUFLEN]; | |
185 | ||
186 | ! list_hashtable_vars(&curbuf->b_vars.dv_hashtab, (char_u *)"b:", TRUE); | |
187 | ||
188 | sprintf((char *)numbuf, "%ld", (long)curbuf->b_changedtick); | |
189 | ! list_one_var_a((char_u *)"b:", (char_u *)"changedtick", VAR_NUMBER, numbuf); | |
190 | } | |
191 | ||
192 | /* | |
193 | * List window variables. | |
194 | */ | |
195 | static void | |
196 | ! list_win_vars() | |
197 | { | |
198 | ! list_hashtable_vars(&curwin->w_vars.dv_hashtab, (char_u *)"w:", TRUE); | |
199 | } | |
200 | ||
201 | #ifdef FEAT_WINDOWS | |
202 | --- 1961,1998 ---- | |
203 | * List global variables. | |
204 | */ | |
205 | static void | |
206 | ! list_glob_vars(first) | |
207 | ! int *first; | |
208 | { | |
209 | ! list_hashtable_vars(&globvarht, (char_u *)"", TRUE, first); | |
210 | } | |
211 | ||
212 | /* | |
213 | * List buffer variables. | |
214 | */ | |
215 | static void | |
216 | ! list_buf_vars(first) | |
217 | ! int *first; | |
218 | { | |
219 | char_u numbuf[NUMBUFLEN]; | |
220 | ||
221 | ! list_hashtable_vars(&curbuf->b_vars.dv_hashtab, (char_u *)"b:", | |
222 | ! TRUE, first); | |
223 | ||
224 | sprintf((char *)numbuf, "%ld", (long)curbuf->b_changedtick); | |
225 | ! list_one_var_a((char_u *)"b:", (char_u *)"changedtick", VAR_NUMBER, | |
226 | ! numbuf, first); | |
227 | } | |
228 | ||
229 | /* | |
230 | * List window variables. | |
231 | */ | |
232 | static void | |
233 | ! list_win_vars(first) | |
234 | ! int *first; | |
235 | { | |
236 | ! list_hashtable_vars(&curwin->w_vars.dv_hashtab, | |
237 | ! (char_u *)"w:", TRUE, first); | |
238 | } | |
239 | ||
240 | #ifdef FEAT_WINDOWS | |
241 | *************** | |
242 | *** 1992,2000 **** | |
243 | * List tab page variables. | |
244 | */ | |
245 | static void | |
246 | ! list_tab_vars() | |
247 | { | |
248 | ! list_hashtable_vars(&curtab->tp_vars.dv_hashtab, (char_u *)"t:", TRUE); | |
249 | } | |
250 | #endif | |
251 | ||
252 | --- 2000,2010 ---- | |
253 | * List tab page variables. | |
254 | */ | |
255 | static void | |
256 | ! list_tab_vars(first) | |
257 | ! int *first; | |
258 | { | |
259 | ! list_hashtable_vars(&curtab->tp_vars.dv_hashtab, | |
260 | ! (char_u *)"t:", TRUE, first); | |
261 | } | |
262 | #endif | |
263 | ||
264 | *************** | |
265 | *** 2002,2040 **** | |
266 | * List Vim variables. | |
267 | */ | |
268 | static void | |
269 | ! list_vim_vars() | |
270 | { | |
271 | ! list_hashtable_vars(&vimvarht, (char_u *)"v:", FALSE); | |
272 | } | |
273 | ||
274 | /* | |
275 | * List script-local variables, if there is a script. | |
276 | */ | |
277 | static void | |
278 | ! list_script_vars() | |
279 | { | |
280 | if (current_SID > 0 && current_SID <= ga_scripts.ga_len) | |
281 | ! list_hashtable_vars(&SCRIPT_VARS(current_SID), (char_u *)"s:", FALSE); | |
282 | } | |
283 | ||
284 | /* | |
285 | * List function variables, if there is a function. | |
286 | */ | |
287 | static void | |
288 | ! list_func_vars() | |
289 | { | |
290 | if (current_funccal != NULL) | |
291 | list_hashtable_vars(¤t_funccal->l_vars.dv_hashtab, | |
292 | ! (char_u *)"l:", FALSE); | |
293 | } | |
294 | ||
295 | /* | |
296 | * List variables in "arg". | |
297 | */ | |
298 | static char_u * | |
299 | ! list_arg_vars(eap, arg) | |
300 | exarg_T *eap; | |
301 | char_u *arg; | |
302 | { | |
303 | int error = FALSE; | |
304 | int len; | |
305 | --- 2012,2055 ---- | |
306 | * List Vim variables. | |
307 | */ | |
308 | static void | |
309 | ! list_vim_vars(first) | |
310 | ! int *first; | |
311 | { | |
312 | ! list_hashtable_vars(&vimvarht, (char_u *)"v:", FALSE, first); | |
313 | } | |
314 | ||
315 | /* | |
316 | * List script-local variables, if there is a script. | |
317 | */ | |
318 | static void | |
319 | ! list_script_vars(first) | |
320 | ! int *first; | |
321 | { | |
322 | if (current_SID > 0 && current_SID <= ga_scripts.ga_len) | |
323 | ! list_hashtable_vars(&SCRIPT_VARS(current_SID), | |
324 | ! (char_u *)"s:", FALSE, first); | |
325 | } | |
326 | ||
327 | /* | |
328 | * List function variables, if there is a function. | |
329 | */ | |
330 | static void | |
331 | ! list_func_vars(first) | |
332 | ! int *first; | |
333 | { | |
334 | if (current_funccal != NULL) | |
335 | list_hashtable_vars(¤t_funccal->l_vars.dv_hashtab, | |
336 | ! (char_u *)"l:", FALSE, first); | |
337 | } | |
338 | ||
339 | /* | |
340 | * List variables in "arg". | |
341 | */ | |
342 | static char_u * | |
343 | ! list_arg_vars(eap, arg, first) | |
344 | exarg_T *eap; | |
345 | char_u *arg; | |
346 | + int *first; | |
347 | { | |
348 | int error = FALSE; | |
349 | int len; | |
350 | *************** | |
351 | *** 2091,2105 **** | |
352 | { | |
353 | switch (*name) | |
354 | { | |
355 | ! case 'g': list_glob_vars(); break; | |
356 | ! case 'b': list_buf_vars(); break; | |
357 | ! case 'w': list_win_vars(); break; | |
358 | #ifdef FEAT_WINDOWS | |
359 | ! case 't': list_tab_vars(); break; | |
360 | #endif | |
361 | ! case 'v': list_vim_vars(); break; | |
362 | ! case 's': list_script_vars(); break; | |
363 | ! case 'l': list_func_vars(); break; | |
364 | default: | |
365 | EMSG2(_("E738: Can't list variables for %s"), name); | |
366 | } | |
367 | --- 2106,2120 ---- | |
368 | { | |
369 | switch (*name) | |
370 | { | |
371 | ! case 'g': list_glob_vars(first); break; | |
372 | ! case 'b': list_buf_vars(first); break; | |
373 | ! case 'w': list_win_vars(first); break; | |
374 | #ifdef FEAT_WINDOWS | |
375 | ! case 't': list_tab_vars(first); break; | |
376 | #endif | |
377 | ! case 'v': list_vim_vars(first); break; | |
378 | ! case 's': list_script_vars(first); break; | |
379 | ! case 'l': list_func_vars(first); break; | |
380 | default: | |
381 | EMSG2(_("E738: Can't list variables for %s"), name); | |
382 | } | |
383 | *************** | |
384 | *** 2116,2122 **** | |
385 | *arg = NUL; | |
386 | list_one_var_a((char_u *)"", | |
387 | arg == arg_subsc ? name : name_start, | |
388 | ! tv.v_type, s == NULL ? (char_u *)"" : s); | |
389 | *arg = c; | |
390 | vim_free(tf); | |
391 | } | |
392 | --- 2131,2139 ---- | |
393 | *arg = NUL; | |
394 | list_one_var_a((char_u *)"", | |
395 | arg == arg_subsc ? name : name_start, | |
396 | ! tv.v_type, | |
397 | ! s == NULL ? (char_u *)"" : s, | |
398 | ! first); | |
399 | *arg = c; | |
400 | vim_free(tf); | |
401 | } | |
402 | *************** | |
403 | *** 18001,18009 **** | |
404 | * List the value of one internal variable. | |
405 | */ | |
406 | static void | |
407 | ! list_one_var(v, prefix) | |
408 | dictitem_T *v; | |
409 | char_u *prefix; | |
410 | { | |
411 | char_u *tofree; | |
412 | char_u *s; | |
413 | --- 18024,18033 ---- | |
414 | * List the value of one internal variable. | |
415 | */ | |
416 | static void | |
417 | ! list_one_var(v, prefix, first) | |
418 | dictitem_T *v; | |
419 | char_u *prefix; | |
420 | + int *first; | |
421 | { | |
422 | char_u *tofree; | |
423 | char_u *s; | |
424 | *************** | |
425 | *** 18011,18026 **** | |
426 | ||
427 | s = echo_string(&v->di_tv, &tofree, numbuf, ++current_copyID); | |
428 | list_one_var_a(prefix, v->di_key, v->di_tv.v_type, | |
429 | ! s == NULL ? (char_u *)"" : s); | |
430 | vim_free(tofree); | |
431 | } | |
432 | ||
433 | static void | |
434 | ! list_one_var_a(prefix, name, type, string) | |
435 | char_u *prefix; | |
436 | char_u *name; | |
437 | int type; | |
438 | char_u *string; | |
439 | { | |
440 | /* don't use msg() or msg_attr() to avoid overwriting "v:statusmsg" */ | |
441 | msg_start(); | |
442 | --- 18035,18051 ---- | |
443 | ||
444 | s = echo_string(&v->di_tv, &tofree, numbuf, ++current_copyID); | |
445 | list_one_var_a(prefix, v->di_key, v->di_tv.v_type, | |
446 | ! s == NULL ? (char_u *)"" : s, first); | |
447 | vim_free(tofree); | |
448 | } | |
449 | ||
450 | static void | |
451 | ! list_one_var_a(prefix, name, type, string, first) | |
452 | char_u *prefix; | |
453 | char_u *name; | |
454 | int type; | |
455 | char_u *string; | |
456 | + int *first; /* when TRUE clear rest of screen and set to FALSE */ | |
457 | { | |
458 | /* don't use msg() or msg_attr() to avoid overwriting "v:statusmsg" */ | |
459 | msg_start(); | |
460 | *************** | |
461 | *** 18052,18057 **** | |
462 | --- 18077,18087 ---- | |
463 | ||
464 | if (type == VAR_FUNC) | |
465 | msg_puts((char_u *)"()"); | |
466 | + if (*first) | |
467 | + { | |
468 | + msg_clr_eos(); | |
469 | + *first = FALSE; | |
470 | + } | |
471 | } | |
472 | ||
473 | /* | |
474 | *** ../vim-7.1.088/src/version.c Thu Aug 30 10:34:19 2007 | |
475 | --- src/version.c Thu Aug 30 11:06:32 2007 | |
476 | *************** | |
477 | *** 668,669 **** | |
478 | --- 668,671 ---- | |
479 | { /* Add new patch number below this line */ | |
480 | + /**/ | |
481 | + 89, | |
482 | /**/ | |
483 | ||
484 | -- | |
485 | Edison's greatest achievement came in 1879, when he invented the | |
486 | electric company. Edison's design was a brilliant adaptation of the | |
487 | simple electrical circuit: the electric company sends electricity | |
488 | through a wire to a customer, then immediately gets the electricity | |
489 | back through another wire | |
490 | ||
491 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
492 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
493 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
494 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |