mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
external pum: use floating point geometry; typval: add tv_dict_add_float
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user