GNU/Linux ◆ screen-256color ◆ bash 139 views

let s:V = vital#vital#new()
let s:Popup = s:V.import('Experimental.UI.Popup')

function! s:update(id) abort
    call s:Popup.contents(a:id, ['hello', 'world'])
    call s:Popup.options(a:id, { 'w': 10, 'h': 10, 'x': 2, 'y': 2 })
    call timer_start(2000, {->s:Popup.hide(a:id)})
endfunction

function! s:on_event(id, data, event) abort
    if a:event ==# 'show'
        call timer_start(1000, {->s:update(a:id)})
    endif
endfunction

let s:pid = s:Popup.create({
    \ 'contents': ['XXXX', 'XXXX', 'XXXX', 'XXXX'],
    \ 'w': 4,
    \ 'h': 4,
    \ 'x': 5,
    \ 'y': 5,
    \ 'pos': 'topcenter',
    \ 'on_event': function('s:on_event'),
    \ })

call cursor(5, 5)