From 970a920385fc903a09f15f92fc785b708dbebff9 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Thu, 20 Jan 2022 13:06:04 -0800 Subject: [PATCH] internal: expose vim.ui.select on_choice to opts --- lua/fzf-lua/providers/ui_select.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/fzf-lua/providers/ui_select.lua b/lua/fzf-lua/providers/ui_select.lua index bc65e3c..d45ec5b 100644 --- a/lua/fzf-lua/providers/ui_select.lua +++ b/lua/fzf-lua/providers/ui_select.lua @@ -77,13 +77,14 @@ M.ui_select = function(items, opts, on_choice) } -- save items so we can access them from the action - _opts.items = items + _opts._items = items + _opts._on_choice = on_choice _opts.actions = vim.tbl_deep_extend("keep", _opts.actions or {}, { ["default"] = function(selected, o) local idx = selected and tonumber(selected[1]:match("^(%d+).")) or nil - on_choice(idx and o.items[idx] or nil, idx) + o._on_choice(idx and o._items[idx] or nil, idx) end })