fix(builtin.builtin): schedule opening next picker (#3222)
Without scheduling, lots of vim state will be related to the builtin picker when the new picker is opened despite closing the builtin picker first and then opening a new picker. This impacts state like `vim.fn.mode()`. If the builtin picker was closed in insert mode, the closing action _should_ put you back in normal mode. But without scheduling, the next picker is opened before it does. So doing `vim.fn.mode()` in the subsequent picker will tell you, you're still in insert mode. Typically, when chaining pickers, you want the pre-telescope state, making the transitions between pickers seemless.
This commit is contained in:
@@ -109,6 +109,7 @@ internal.builtin = function(opts)
|
||||
end
|
||||
|
||||
actions.close(prompt_bufnr)
|
||||
vim.schedule(function()
|
||||
if string.match(selection.text, " : ") then
|
||||
-- Call appropriate function from extensions
|
||||
local split_string = vim.split(selection.text, " : ")
|
||||
@@ -120,6 +121,7 @@ internal.builtin = function(opts)
|
||||
require("telescope.builtin")[selection.text](picker_opts)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user