]> granicus.if.org Git - vim/commitdiff
patch 8.1.1560: popup window hidden option not implemented yet v8.1.1560
authorBram Moolenaar <Bram@vim.org>
Sun, 16 Jun 2019 18:39:13 +0000 (20:39 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 16 Jun 2019 18:39:13 +0000 (20:39 +0200)
Problem:    Popup window hidden option not implemented yet.
Solution:   Implement the hidden option.

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

index 3603a1c7172fe08933e09e8027fa5c63f408900d..c042fe82d8608fe23f852cb311ac014030946291 100644 (file)
@@ -428,6 +428,13 @@ apply_options(win_T *wp, buf_T *buf UNUSED, dict_T *dict)
            semsg(_(e_invarg2), tv_get_string(&di->di_tv));
     }
 
+    nr = dict_get_number(dict, (char_u *)"hidden");
+    if (nr > 0)
+    {
+       wp->w_popup_flags |= POPF_HIDDEN;
+       --wp->w_buffer->b_nwindows;
+    }
+
     popup_mask_refresh = TRUE;
 }
 
index 3f5c9d1691fccfb4576911103c4c0bef10c233ae..749660805c2876fd5e5d7ded8e888ba8f6edd176 100644 (file)
@@ -1310,7 +1310,7 @@ func Test_notifications()
   call delete('XtestNotifications')
 endfunc
 
-function Test_popup_settext()
+func Test_popup_settext()
   if !CanRunVimInTerminal()
     throw 'Skipped: cannot make screendumps'
   endif
@@ -1352,4 +1352,38 @@ function Test_popup_settext()
   " clean up
   call StopVimInTerminal(buf)
   call delete('XtestPopupSetText')
-endfunction
+endfunc
+
+func Test_popup_hidden()
+  new
+
+  let winid = popup_atcursor('text', {'hidden': 1})
+  redraw
+  call assert_equal(0, popup_getpos(winid).visible)
+  call popup_close(winid)
+
+  let winid = popup_create('text', {'hidden': 1})
+  redraw
+  call assert_equal(0, popup_getpos(winid).visible)
+  call popup_close(winid)
+
+  func QuitCallback(id, res)
+    let s:cb_winid = a:id
+    let s:cb_res = a:res
+  endfunc
+  let winid = popup_dialog('make a choice', {'hidden': 1,
+         \ 'filter': 'popup_filter_yesno',
+         \ 'callback': 'QuitCallback',
+         \ })
+  redraw
+  call assert_equal(0, popup_getpos(winid).visible)
+  exe "normal anot used by filter\<Esc>"
+  call assert_equal('not used by filter', getline(1))
+
+  call popup_show(winid)
+  call feedkeys('y', "xt")
+  call assert_equal(1, s:cb_res)
+
+  bwipe!
+  delfunc QuitCallback
+endfunc
index ad09b56ef00fe7c399c1d077d5c95da83f98dd24..ea203f691335873eda85810466f3ebc67f963916 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1560,
 /**/
     1559,
 /**/