mirror of
https://github.com/vim/vim.git
synced 2025-10-28 09:27:14 -04:00
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Problem: Vim9: cannot use "true" for some popup options. Solution: Add dict_get_bool(). (closes #6725)
This commit is contained in:
15
src/dict.c
15
src/dict.c
@@ -702,6 +702,21 @@ dict_get_number_check(dict_T *d, char_u *key)
|
||||
return tv_get_number(&di->di_tv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a bool item (number or true/false) from a dictionary.
|
||||
* Returns "def" if the entry doesn't exist.
|
||||
*/
|
||||
varnumber_T
|
||||
dict_get_bool(dict_T *d, char_u *key, int def)
|
||||
{
|
||||
dictitem_T *di;
|
||||
|
||||
di = dict_find(d, key, -1);
|
||||
if (di == NULL)
|
||||
return def;
|
||||
return tv_get_bool(&di->di_tv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return an allocated string with the string representation of a Dictionary.
|
||||
* May return NULL.
|
||||
|
||||
Reference in New Issue
Block a user