@@ -44,21 +44,41 @@ function! s:create(opt) abort
44
44
endif
45
45
let s: _popups [id] = data
46
46
call s: _notify (id, {}, ' create' )
47
+ call s: _notify (id, {}, ' show' )
47
48
return id
48
49
endfunction
49
50
50
51
function ! s: close (id) abort
51
- if has_key (s: _popups , a: id )
52
- let data = s: _popups [a: id ]
53
- if s: _has_nvim
54
- call nvim_win_close (data[' winid' ], 1 )
55
- let data[' winid' ] = 0
56
- else
57
- call popup_close (data[' winid' ])
58
- endif
59
- call s: _notify (a: id , {}, ' close' )
60
- call remove (s: _popups , a: id )
52
+ let data = s: _popups [a: id ]
53
+ if s: _has_nvim
54
+ call nvim_win_close (data[' winid' ], 1 )
55
+ let data[' winid' ] = 0
56
+ else
57
+ call popup_close (data[' winid' ])
58
+ endif
59
+ call s: _notify (a: id , {}, ' close' )
60
+ call remove (s: _popups , a: id )
61
+ endfunction
62
+
63
+ function ! s: hide (id) abort
64
+ let data = s: _popups [a: id ]
65
+ if s: _has_nvim
66
+ call nvim_win_close (data[' winid' ], 1 )
67
+ let data[' winid' ] = 0
68
+ else
69
+ call popup_hide (data[' winid' ])
70
+ endif
71
+ call s: _notify (a: id , {}, ' hide' )
72
+ endfunction
73
+
74
+ function ! s: show (id) abort
75
+ let data = s: _popups [a: id ]
76
+ if s: _has_nvim
77
+ let data[' winid' ] = s: _nvim_open_win (a: id , data)
78
+ else
79
+ call popup_show (data[' winid' ])
61
80
endif
81
+ call s: _notify (a: id , {}, ' show' )
62
82
endfunction
63
83
64
84
function ! s: _nvim_open_win (id, data) abort
@@ -71,7 +91,7 @@ function! s:_nvim_open_win(id, data) abort
71
91
\ ' row' : a: data [' sy' ],
72
92
\ ' focusable' : 0 ,
73
93
\ }
74
- return nvim_open_win (a: data [' bufnr' ], 1 , opt )
94
+ return nvim_open_win (a: data [' bufnr' ], 0 , opt )
75
95
endfunction
76
96
77
97
function ! s: _set (data, opt ) abort
0 commit comments