Skip to content

Commit 6313c4f

Browse files
committed
patch 8.1.1560: popup window hidden option not implemented yet
Problem: Popup window hidden option not implemented yet. Solution: Implement the hidden option.
1 parent eb2310d commit 6313c4f

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

src/popupwin.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,13 @@ apply_options(win_T *wp, buf_T *buf UNUSED, dict_T *dict)
428428
semsg(_(e_invarg2), tv_get_string(&di->di_tv));
429429
}
430430

431+
nr = dict_get_number(dict, (char_u *)"hidden");
432+
if (nr > 0)
433+
{
434+
wp->w_popup_flags |= POPF_HIDDEN;
435+
--wp->w_buffer->b_nwindows;
436+
}
437+
431438
popup_mask_refresh = TRUE;
432439
}
433440

src/testdir/test_popupwin.vim

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ func Test_notifications()
13101310
call delete('XtestNotifications')
13111311
endfunc
13121312

1313-
function Test_popup_settext()
1313+
func Test_popup_settext()
13141314
if !CanRunVimInTerminal()
13151315
throw 'Skipped: cannot make screendumps'
13161316
endif
@@ -1352,4 +1352,38 @@ function Test_popup_settext()
13521352
" clean up
13531353
call StopVimInTerminal(buf)
13541354
call delete('XtestPopupSetText')
1355-
endfunction
1355+
endfunc
1356+
1357+
func Test_popup_hidden()
1358+
new
1359+
1360+
let winid = popup_atcursor('text', {'hidden': 1})
1361+
redraw
1362+
call assert_equal(0, popup_getpos(winid).visible)
1363+
call popup_close(winid)
1364+
1365+
let winid = popup_create('text', {'hidden': 1})
1366+
redraw
1367+
call assert_equal(0, popup_getpos(winid).visible)
1368+
call popup_close(winid)
1369+
1370+
func QuitCallback(id, res)
1371+
let s:cb_winid = a:id
1372+
let s:cb_res = a:res
1373+
endfunc
1374+
let winid = popup_dialog('make a choice', {'hidden': 1,
1375+
\ 'filter': 'popup_filter_yesno',
1376+
\ 'callback': 'QuitCallback',
1377+
\ })
1378+
redraw
1379+
call assert_equal(0, popup_getpos(winid).visible)
1380+
exe "normal anot used by filter\<Esc>"
1381+
call assert_equal('not used by filter', getline(1))
1382+
1383+
call popup_show(winid)
1384+
call feedkeys('y', "xt")
1385+
call assert_equal(1, s:cb_res)
1386+
1387+
bwipe!
1388+
delfunc QuitCallback
1389+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1560,
780782
/**/
781783
1559,
782784
/**/

0 commit comments

Comments
 (0)