feat(pickers): add an option to resume and select the entry

This commit is contained in:
delphinus
2025-01-08 18:27:24 +09:00
parent 415af52339
commit bcdfac0d0d
3 changed files with 19 additions and 0 deletions
+6
View File
@@ -324,6 +324,8 @@ function Picker:new(opts)
cache_picker = config.resolve_table_opts(opts.cache_picker, vim.deepcopy(config.values.cache_picker)),
_select_pos = opts._select_pos,
__scrolling_limit = tonumber(vim.F.if_nil(opts.temp__scrolling_limit, 250)),
__locations_input = vim.F.if_nil(opts.__locations_input, false),
@@ -1708,6 +1710,10 @@ function Picker:_resume_picker()
vim.cmd "do User TelescopeResumePost"
end)
end
if self._select_pos then
self:move_selection(self._select_pos)
vim.schedule_wrap(actions.select_default)(self.prompt_bufnr)
end
end
-- if text changed, required to set anew to restart finder; otherwise hl and selection
if self.cache_picker.cached_prompt ~= self.default_text then