Skip to content

Commit

Permalink
VS.Vim.Window.FloatingWindow: Add popup_setoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
hrsh7th committed Jun 11, 2021
1 parent e3ab1db commit 76d1d21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion autoload/vital/__vital__/VS/Vim/Window/FloatingWindow.vim
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ else
let a:self._on_closed = l:On_closed
return s:_open(a:bufnr, a:style, { -> a:self._on_closed() })
endif
call popup_move(a:winid, s:_style(a:style))
let l:style = s:_style(a:style)
call popup_move(a:winid, l:style)
call popup_setoptions(a:winid, l:style)
return a:winid
endfunction
endif
Expand Down
19 changes: 11 additions & 8 deletions autoload/vital/__vital__/VS/Vim/Window/FloatingWindow.vimspec
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,32 @@ Describe vital#__vital__#VS#Vim#Window#FloatingWindow
End

It should not callback on move with other bufnr (vim only)
if has('nvim')
return
endif

let s:closed = 0
let l:win = s:FloatingWindow.new({
\ 'on_closed': { -> execute('let s:closed += 1') }
\ })
call l:win.set_bufnr(s:Buffer.create())
call setbufline(l:win.get_bufnr(), 1, [1,2,3,4,5,6,7,8,9,0])
call l:win.open({
\ 'row': 1,
\ 'col': 1,
\ 'width': 10,
\ 'height': 10,
\ 'width': 3,
\ 'height': 3,
\ 'topline': 3,
\ })
call s:expect(l:win.info().topline).to_equal(3)
call l:win.set_bufnr(s:Buffer.create())
call setbufline(l:win.get_bufnr(), 1, [1,2,3,4,5,6,7,8,9,0])
call l:win.open({
\ 'row': 1,
\ 'col': 1,
\ 'width': 10,
\ 'height': 10,
\ 'width': 3,
\ 'height': 3,
\ 'topline': 5,
\ })
call s:expect(s:closed).to_equal(0)
call s:expect(l:win.info().topline).to_equal(5)
cal l:win.close()
End

It should callback on closed by command (nvim only)
Expand Down

0 comments on commit 76d1d21

Please sign in to comment.