nvim-telescope / telescope-ui-select.nvim

MIT License
774 stars 18 forks source link

Pressing `ESC` does not abort `vim.ui.select` but pass nil to the callback function. #41

Closed milanglacier closed 8 months ago

milanglacier commented 8 months ago

my config:

    extensions = {
        ['ui-select'] = {
            require('telescope.themes').get_dropdown {},
        },
    },

a minimal example: :lua vim.ui.select({1,2}, {}, function(n) vim.notify({tostring(n)}) end)

and press <ESC> twice.

Expected result: the function will be aborted and nothing happend Actual Result: nil is printed.

Conni2461 commented 8 months ago

This is the same behavior like in neovim:

see https://github.com/nvim-telescope/telescope-ui-select.nvim/issues/32 https://github.com/neovim/neovim/blob/488038580934f301c1528a14548ec0cabd16c2cd/runtime/lua/vim/ui.lua#L39-L56 and see :help vim.ui.select

      • {on_choice}  (function) ((item|nil, idx|nil) -> ()) Called once the
                     user made a choice. `idx` is the 1-based index of `item`
                     within `items`. `nil` if the user aborted the dialog.
milanglacier commented 8 months ago

Thanks for the clarification.