comparison src/dict.c @ 16268:0f65f2808470 v8.1.1138

patch 8.1.1138: plugins don't get notified when the popup menu changes commit https://github.com/vim/vim/commit/d7f246c68cfb97406bcd4b098a2df2d870b3ef92 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 8 18:15:41 2019 +0200 patch 8.1.1138: plugins don't get notified when the popup menu changes Problem: Plugins don't get notified when the popup menu changes. Solution: Add the CompleteChanged event. (Andy Massimino. closes https://github.com/vim/vim/issues/4176)
author Bram Moolenaar <Bram@vim.org>
date Mon, 08 Apr 2019 18:30:06 +0200
parents 5b6c3c7feba8
children 54ffc82f38a8
comparison
equal deleted inserted replaced
16267:b471858040bc 16268:0f65f2808470
340 { 340 {
341 return hash_add(&d->dv_hashtab, item->di_key); 341 return hash_add(&d->dv_hashtab, item->di_key);
342 } 342 }
343 343
344 /* 344 /*
345 * Add a number entry to dictionary "d". 345 * Add a number or special entry to dictionary "d".
346 * Returns FAIL when out of memory and when key already exists. 346 * Returns FAIL when out of memory and when key already exists.
347 */ 347 */
348 int 348 static int
349 dict_add_number(dict_T *d, char *key, varnumber_T nr) 349 dict_add_number_special(dict_T *d, char *key, varnumber_T nr, int special)
350 { 350 {
351 dictitem_T *item; 351 dictitem_T *item;
352 352
353 item = dictitem_alloc((char_u *)key); 353 item = dictitem_alloc((char_u *)key);
354 if (item == NULL) 354 if (item == NULL)
355 return FAIL; 355 return FAIL;
356 item->di_tv.v_type = VAR_NUMBER; 356 item->di_tv.v_type = special ? VAR_SPECIAL : VAR_NUMBER;
357 item->di_tv.vval.v_number = nr; 357 item->di_tv.vval.v_number = nr;
358 if (dict_add(d, item) == FAIL) 358 if (dict_add(d, item) == FAIL)
359 { 359 {
360 dictitem_free(item); 360 dictitem_free(item);
361 return FAIL; 361 return FAIL;
362 } 362 }
363 return OK; 363 return OK;
364 }
365
366 /*
367 * Add a number entry to dictionary "d".
368 * Returns FAIL when out of memory and when key already exists.
369 */
370 int
371 dict_add_number(dict_T *d, char *key, varnumber_T nr)
372 {
373 return dict_add_number_special(d, key, nr, FALSE);
374 }
375
376 /*
377 * Add a special entry to dictionary "d".
378 * Returns FAIL when out of memory and when key already exists.
379 */
380 int
381 dict_add_special(dict_T *d, char *key, varnumber_T nr)
382 {
383 return dict_add_number_special(d, key, nr, TRUE);
364 } 384 }
365 385
366 /* 386 /*
367 * Add a string entry to dictionary "d". 387 * Add a string entry to dictionary "d".
368 * Returns FAIL when out of memory and when key already exists. 388 * Returns FAIL when out of memory and when key already exists.