Skip to content

Commit

Permalink
Fix unable to abort or cancel show_tag_picker on fzf_lua issue (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-danko authored Oct 1, 2024
1 parent 8942fcc commit 16fc98c
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions lua/zk/pickers/fzf_lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,19 @@ function M.show_tag_picker(tags, options, cb)
["--exact"] = "",
["--tabstop"] = 4,
},
fn_selected = function(selected, _)
-- for some reason, fzf lua returns an empty string as the first selected line. this was
-- causing the tbl_map to generate a result zk-nvim can't resolve to open notes
table.remove(selected, 1)
local selected_tags = vim.tbl_map(function(line)
local name = string.match(line, "%d+%s+" .. delimiter .. "(.+)")
return tags_by_name[name]
end, selected)
if options.multi_select then
cb(selected_tags)
else
cb(selected_tags[1])
end
end,
actions = {
["default"] = function(selected, _)
local selected_tags = vim.tbl_map(function(line)
local name = string.match(line, "%d+%s+" .. delimiter .. "(.+)")
return tags_by_name[name]
end, selected)
if options.multi_select then
cb(selected_tags)
else
cb(selected_tags[1])
end
end,
},
}, options.fzf_lua or {})

exec(function(fzf_cb)
Expand Down

0 comments on commit 16fc98c

Please sign in to comment.