Skip to content

Commit

Permalink
fix: trigger on choice only once (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conni2461 authored Dec 4, 2023
1 parent c261d90 commit 6e51d7d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/telescope/_extensions/ui-select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@ return require("telescope").register_extension {
attach_mappings = function(prompt_bufnr)
actions.select_default:replace(function()
local selection = action_state.get_selected_entry()
local cb = on_choice
on_choice = function(_, _) end
actions.close(prompt_bufnr)
if selection == nil then
utils.__warn_no_selection "ui-select"
on_choice(nil, nil)
cb(nil, nil)
return
end
on_choice(selection.value.text, selection.value.idx)
cb(selection.value.text, selection.value.idx)
end)
actions.close:enhance {
post = function()
Expand Down

0 comments on commit 6e51d7d

Please sign in to comment.