repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix(cmdline.popupmenu): add forward declaration for on_hide callback

64f7392772d11a7595ae181a03eb1e5024236d8a

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Same upvalue capture bug as viewer.lua - on_show() calls on_hide() but
on_hide was defined later in the file. Lua's local function syntax
captures nil at definition time instead of using late binding.

Changed files (1)

+3 / −1 text lines

neovim/lua/bugabinga/cmdline/popupmenu.lua

Modified

+3 / −1 text lines

18 18 top_idx = 0,
21 +local on_hide
21 23 local function kind_icon(kind)
22 24 if not kind or kind == '' then
23 25 return ''
273 -local function on_hide()
275 +on_hide = function()
274 276 if vim.api.nvim_win_is_valid(state.window) then
275 277 vim.api.nvim_win_hide(state.window)