Mercurial > vim
diff src/dict.c @ 17123:efc6f5e3b543 v8.1.1561
patch 8.1.1561: popup_setoptions() is not implemented yet
commit https://github.com/vim/vim/commit/ae943150d3a2868a89df802c9f530331474451ec
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 16 22:54:14 2019 +0200
patch 8.1.1561: popup_setoptions() is not implemented yet
Problem: Popup_setoptions() is not implemented yet.
Solution: Implement popup_setoptions(). Also add more fields to
popup_getoptions().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 16 Jun 2019 23:00:05 +0200 |
parents | 23645f9a5ce2 |
children | 3fd0765f454f |
line wrap: on
line diff
--- a/src/dict.c +++ b/src/dict.c @@ -448,6 +448,27 @@ dict_add_list(dict_T *d, char *key, list } /* + * Add a callback to dictionary "d". + * Returns FAIL when out of memory and when key already exists. + */ + int +dict_add_callback(dict_T *d, char *key, callback_T *cb) +{ + dictitem_T *item; + + item = dictitem_alloc((char_u *)key); + if (item == NULL) + return FAIL; + put_callback(cb, &item->di_tv); + if (dict_add(d, item) == FAIL) + { + dictitem_free(item); + return FAIL; + } + return OK; +} + +/* * Initializes "iter" for iterating over dictionary items with * dict_iterate_next(). * If "var" is not a Dict or an empty Dict then there will be nothing to