]> granicus.if.org Git - vim/commitdiff
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option v8.2.1763
authorBram Moolenaar <Bram@vim.org>
Sun, 27 Sep 2020 19:16:45 +0000 (21:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 27 Sep 2020 19:16:45 +0000 (21:16 +0200)
Problem:    Vim9: cannot use "true" for popup window scrollbar option.
Solution:   use dict_get_bool(). (closes #7029)

src/popupwin.c
src/testdir/test_popupwin.vim
src/version.c

index cdd7677e77fb1632af460dced13de6216c8a48d6..05db1af631374f8505b1ab1dc77ee63cfaf0fa99 100644 (file)
@@ -665,9 +665,9 @@ apply_general_options(win_T *wp, dict_T *dict)
            wp->w_firstline = -1;
     }
 
-    di = dict_find(dict, (char_u *)"scrollbar", -1);
-    if (di != NULL)
-       wp->w_want_scrollbar = dict_get_number(dict, (char_u *)"scrollbar");
+    nr = dict_get_bool(dict, (char_u *)"scrollbar", -1);
+    if (nr != -1)
+       wp->w_want_scrollbar = nr;
 
     str = dict_get_string(dict, (char_u *)"title", FALSE);
     if (str != NULL)
index 65a6805e25904253d886c6c118de3b3e7159889f..fdd9ac45e4122d3bec9b857afdf05f7d5670662d 100644 (file)
@@ -2168,6 +2168,21 @@ func Test_popup_scrollbar()
       endif
     endfunc
 
+    def CreatePopup(text: list<string>)
+      popup_create(text, #{
+           \ minwidth: 30,
+           \ maxwidth: 30,
+           \ minheight: 4,
+           \ maxheight: 4,
+           \ firstline: 1,
+           \ lastline: 4,
+           \ wrap: true,
+           \ scrollbar: true,
+           \ mapping: false,
+           \ filter: Popup_filter,
+           \ })
+    enddef
+
     func PopupScroll()
       call popup_clear()
       let text =<< trim END
@@ -2179,18 +2194,7 @@ func Test_popup_scrollbar()
          long line long line long line long line long line long line
          long line long line long line long line long line long line
       END
-      call popup_create(text, #{
-           \ minwidth: 30,
-           \ maxwidth: 30,
-           \ minheight: 4,
-           \ maxheight: 4,
-           \ firstline: 1,
-           \ lastline: 4,
-           \ wrap: v:true,
-           \ scrollbar: v:true,
-           \ mapping: v:false,
-           \ filter: funcref('Popup_filter')
-           \ })
+      call CreatePopup(text)
     endfunc
     map <silent> <F3> :call test_setmouse(5, 36)<CR>
     map <silent> <F4> :call test_setmouse(4, 42)<CR>
index d6006185cc55f2de0aa225a3f8659440da923062..60ab7d1d6c8c14df1b3f34318616074e94d7a8ae 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1763,
 /**/
     1762,
 /**/