nvim-telescope / telescope-ui-select.nvim

MIT License
774 stars 18 forks source link

BUG: on_choice is called twice #38

Closed alfaix closed 8 months ago

alfaix commented 8 months ago

Hello,

First of all thanks a lot for the awesome plugin :) It's a small but very sweet UI improvement - I love things like this!

I believe this commit introduced a regression. If I choose something, on_choice is called twice. I don't have a minimal_init, but you can probably try it with your own init. To reproduce, run this little script:

vim.ui.select({"a", "b", "c"}, {}, function(item, idx) vim.notify(vim.inspect({item, idx})) end)

And then select any item.

What you will see is two notifications, {} and the actual choice. I believe it's because actions.close is called even in case I actually selected something. This introduces some hard-to-track issues in code that is using vim.ui.select.

Conni2461 commented 8 months ago

you are right, sorry my bad. https://github.com/nvim-telescope/telescope-ui-select.nvim/pull/39 should fix your issue. can you confirm?

alfaix commented 8 months ago

Yes, that fixes it, thanks!