diff options
author | Matthieu Coudron <mattator@gmail.com> | 2020-04-27 21:12:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-27 21:12:12 +0200 |
commit | c7d3630e214012667e855c30cde2808a5fe59650 (patch) | |
tree | cc2024053865052d34e7e8ebebbd45a4064d29ee /src/nvim/eval/typval.c | |
parent | d90a92bcd3c18111abb62a57192c9e151839a7f4 (diff) | |
parent | e34684b2ad02e759dec39c0f0958c7882120ecdc (diff) | |
download | rneovim-c7d3630e214012667e855c30cde2808a5fe59650.tar.gz rneovim-c7d3630e214012667e855c30cde2808a5fe59650.tar.bz2 rneovim-c7d3630e214012667e855c30cde2808a5fe59650.zip |
Merge pull request #11943 from yatli/master
[RDY] API/UI: Allow UI to set PUM position and size, and pass the position to CompleteChanged
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r-- | src/nvim/eval/typval.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index c8b5fc294c..773e493d0b 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1634,6 +1634,28 @@ int tv_dict_add_nr(dict_T *const d, const char *const key, return OK; } +/// Add a floating point number entry to dictionary +/// +/// @param[out] d Dictionary to add entry to. +/// @param[in] key Key to add. +/// @param[in] key_len Key length. +/// @param[in] nr Floating point number to add. +/// +/// @return OK in case of success, FAIL when key already exists. +int tv_dict_add_float(dict_T *const d, const char *const key, + const size_t key_len, const float_T nr) +{ + dictitem_T *const item = tv_dict_item_alloc_len(key, key_len); + + item->di_tv.v_type = VAR_FLOAT; + item->di_tv.vval.v_float = nr; + if (tv_dict_add(d, item) == FAIL) { + tv_dict_item_free(item); + return FAIL; + } + return OK; +} + /// Add a special entry to dictionary /// /// @param[out] d Dictionary to add entry to. |