Skip to content

Commit c63b13a

Browse files
add s:_nvim_open_win
1 parent 9680b6f commit c63b13a

File tree

1 file changed

+14
-10
lines changed
  • autoload/vital/__vital__/Experimental/UI

1 file changed

+14
-10
lines changed

autoload/vital/__vital__/Experimental/UI/Popup.vim

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,7 @@ function! s:create(opt) abort
2626
if s:_has_nvim
2727
let data['bufnr'] = nvim_create_buf(0, 1)
2828
call nvim_buf_set_lines(data['bufnr'], 0, -1, 1, data['contents'])
29-
let opt = {
30-
\ 'relative': 'editor',
31-
\ 'style': 'minimal',
32-
\ 'width': data['w'],
33-
\ 'height': data['h'],
34-
\ 'col': data['sx'],
35-
\ 'row': data['sy'],
36-
\ 'focusable': 0,
37-
\ }
38-
let data['winid'] = nvim_open_win(data['bufnr'], 1, opt)
29+
let data['winid'] = s:_nvim_open_win(id, data)
3930
else
4031
" neovim doesn't support scrollbar so don't enable it
4132
let data['winid'] = popup_create(data['contents'], {
@@ -69,6 +60,19 @@ function! s:close(id) abort
6960
endif
7061
endfunction
7162

63+
function! s:_nvim_open_win(id, data) abort
64+
let opt = {
65+
\ 'relative': 'editor',
66+
\ 'style': 'minimal',
67+
\ 'width': a:data['w'],
68+
\ 'height': a:data['h'],
69+
\ 'col': a:data['sx'],
70+
\ 'row': a:data['sy'],
71+
\ 'focusable': 0,
72+
\ }
73+
return nvim_open_win(a:data['bufnr'], 1, opt)
74+
endfunction
75+
7276
function! s:_set(data, opt) abort
7377
" copy all callbacks to data
7478
for [key, Cb] in items(a:opt)

0 commit comments

Comments
 (0)