0
0
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:
Bram Moolenaar
2020-08-18 13:04:15 +02:00
parent f39397e515
commit 558813314d
4 changed files with 33 additions and 21 deletions

View File

@@ -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.