summaryrefslogtreecommitdiff
path: root/src/popupwin.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-18 13:04:15 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-18 13:04:15 +0200
commit558813314d63dd0263a7a86c0496c1e89b5c8cba (patch)
tree7ebfbe1f61edc2bfb5fc82f354bf6f7cae5391ec /src/popupwin.c
parentf39397e515067d5a314be99778e63fe0acf93c51 (diff)
downloadvim-git-558813314d63dd0263a7a86c0496c1e89b5c8cba.tar.gz
patch 8.2.1478: Vim9: cannot use "true" for some popup optionsv8.2.1478
Problem: Vim9: cannot use "true" for some popup options. Solution: Add dict_get_bool(). (closes #6725)
Diffstat (limited to 'src/popupwin.c')
-rw-r--r--src/popupwin.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index ff9e81004..4b85fec19 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -438,9 +438,10 @@ apply_move_options(win_T *wp, dict_T *d)
if (nr != MAXCOL)
wp->w_wantcol = nr;
- di = dict_find(d, (char_u *)"fixed", -1);
- if (di != NULL)
- wp->w_popup_fixed = dict_get_number(d, (char_u *)"fixed") != 0;
+
+ nr = dict_get_bool(d, (char_u *)"fixed", -1);
+ if (nr != -1)
+ wp->w_popup_fixed = nr != 0;
{
poppos_T ppt = get_pos_entry(d, TRUE);
@@ -674,37 +675,31 @@ apply_general_options(win_T *wp, dict_T *dict)
wp->w_popup_title = vim_strsave(str);
}
- di = dict_find(dict, (char_u *)"wrap", -1);
- if (di != NULL)
- {
- nr = dict_get_number(dict, (char_u *)"wrap");
+ nr = dict_get_bool(dict, (char_u *)"wrap", -1);
+ if (nr != -1)
wp->w_p_wrap = nr != 0;
- }
- di = dict_find(dict, (char_u *)"drag", -1);
- if (di != NULL)
+ nr = dict_get_bool(dict, (char_u *)"drag", -1);
+ if (nr != -1)
{
- nr = dict_get_number(dict, (char_u *)"drag");
if (nr)
wp->w_popup_flags |= POPF_DRAG;
else
wp->w_popup_flags &= ~POPF_DRAG;
}
- di = dict_find(dict, (char_u *)"posinvert", -1);
- if (di != NULL)
+ nr = dict_get_bool(dict, (char_u *)"posinvert", -1);
+ if (nr != -1)
{
- nr = dict_get_number(dict, (char_u *)"posinvert");
if (nr)
wp->w_popup_flags |= POPF_POSINVERT;
else
wp->w_popup_flags &= ~POPF_POSINVERT;
}
- di = dict_find(dict, (char_u *)"resize", -1);
- if (di != NULL)
+ nr = dict_get_bool(dict, (char_u *)"resize", -1);
+ if (nr != -1)
{
- nr = dict_get_number(dict, (char_u *)"resize");
if (nr)
wp->w_popup_flags |= POPF_RESIZE;
else
@@ -902,10 +897,9 @@ apply_general_options(win_T *wp, dict_T *dict)
set_callback(&wp->w_filter_cb, &callback);
}
}
- di = dict_find(dict, (char_u *)"mapping", -1);
- if (di != NULL)
+ nr = dict_get_bool(dict, (char_u *)"mapping", -1);
+ if (nr != -1)
{
- nr = dict_get_number(dict, (char_u *)"mapping");
if (nr)
wp->w_popup_flags |= POPF_MAPPING;
else
@@ -950,7 +944,7 @@ apply_options(win_T *wp, dict_T *dict)
apply_general_options(wp, dict);
- nr = dict_get_number(dict, (char_u *)"hidden");
+ nr = dict_get_bool(dict, (char_u *)"hidden", FALSE);
if (nr > 0)
wp->w_popup_flags |= POPF_HIDDEN;