summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2022-07-16 09:56:33 +0200
committerGitHub <noreply@github.com>2022-07-16 09:56:33 +0200
commit6bddc38c25af7b50f99cb0c035248d7272971810 (patch)
tree4b74c5b63f60c7f8622daf43471899c8794e3886 /lua
parentb79cd6c88b3d96b0f49cb7d240807cd59b610cd8 (diff)
fix: push history on refine (#2074)
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/actions/generate.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/lua/telescope/actions/generate.lua b/lua/telescope/actions/generate.lua
index 672cc38..93a7727 100644
--- a/lua/telescope/actions/generate.lua
+++ b/lua/telescope/actions/generate.lua
@@ -66,8 +66,13 @@ action_generate.refine = function(prompt_bufnr, opts)
opts.reset_multi_selection = vim.F.if_nil(opts.reset_multi_selection, false)
opts.reset_prompt = vim.F.if_nil(opts.reset_prompt, true)
opts.sorter = vim.F.if_nil(opts.sorter, config.values.generic_sorter {})
+ local push_history = vim.F.if_nil(opts.push_history, true)
local current_picker = action_state.get_current_picker(prompt_bufnr)
+ local current_line = action_state.get_current_line()
+ if push_history then
+ action_state.get_current_history():append(current_line, current_picker)
+ end
-- title
if opts.prompt_title then
@@ -97,15 +102,14 @@ action_generate.refine = function(prompt_bufnr, opts)
end,
}
- if not opts.reset_multi_selection and action_state.get_current_line() ~= "" then
+ if not opts.reset_multi_selection and current_line ~= "" then
opts.multi = current_picker._multi
end
if opts.prompt_to_prefix then
- local prompt = action_state.get_current_line()
local current_prefix = current_picker.prompt_prefix
local suffix = current_prefix ~= opts.prompt_prefix and current_prefix or ""
- opts.new_prefix = suffix .. prompt .. " " .. opts.prompt_prefix
+ opts.new_prefix = suffix .. current_line .. " " .. opts.prompt_prefix
end
current_picker:refresh(new_finder, opts)
end