Lifepillar
unread,Sep 3, 2020, 9:26:31 AM9/3/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim...@googlegroups.com
How do you handle counts with a popup menu filter?
Something like this almost works:
let s:n = 0
fun MyFilter(winid, key)
if a:key == '+'
let s:n += v:count1
call popup_settext(a:winid, printf('Value: %d', s:n))
return 1
endif
return 0
endf
let id = popup_create('Value: 0',
\ #{ close: 'button',
\ border:[1,1,1,1],
\ filter: 'MyFilter'})
I can type, say, 5+ to have the counter increased by 5.
Unfortunately, v:count1 is not cleared after that, so if I type 3+ next,
the counter is increased by 53 instead of 3. Is there a workaround?
Thanks,
Life.