-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] add popup support #748
base: master
Are you sure you want to change the base?
Conversation
Since neovim and vim using different position. I'm now using Simple way to check the position is using this file.
Then run this code let s:V = vital#vital#new()
let s:Popup = s:V.import('Experimental.UI.Popup')
call s:Popup.create({
\ 'contents': ['XXXX', 'XXXX', 'XXXX', 'XXXX'],
\ 'w': 4,
\ 'h': 4,
\ 'x': 5,
\ 'y': 5,
\ 'pos': 'topcenter',
\ })
call cursor(5, 5) Here is how |
fa15108
to
9fe3c45
Compare
Added support for events. One can use either generic function! s:on_event(id, data, event) abort
echom a:event
endfunction
let s:pid = s:Popup.create({
\ 'contents': ['XXXX', 'XXXX', 'XXXX', 'XXXX'],
\ 'w': 4,
\ 'h': 4,
\ 'x': 5,
\ 'y': 5,
\ 'pos': 'topcenter',
\ 'on_create': {id, data, event->timer_start(2000, {->s:Popup.close(id)})},
\ 'on_event': function('s:on_event'),
\ }) Feel free to review the code. |
contents() api to change the contents of the popup and options() api to move and resize the popup. https://asciinema.org/a/360796 |
860bf43
to
274654a
Compare
E.g. in neovim, the indexing for window placement starts from In the same way, which corner of the screen do you start your co-ordinates from, and what value it starts from? Also, just being sure, by Just for clarity |
Currently I use x is width and y is height. If you have better suggestions let me know. |
PR for #747. This PR is at a very early stage so will need lot of revisions but starting a thread so folks can start contributing and looking at it and provide feedback.
Goal is to have a consistent api that works on both vim and neovim. It is also meant to be very dumb api where other powerful popup manager can be built on top. It is also meant to easily work with lua apis hence it uses
id
new({})
to create popupclose(id)
pos: 'topleft|topright|bottomleft|bottomright|topcenter|bottomcenter'
hide(id)
show(id)
contents(['line1', 'line2'])
to update popup textoptions()
to move, resize popup.... and many more... feel free to suggest
Events
before
andafter
events. eitherbeforeshow
aftershow
orpreshow
postshow
.