summaryrefslogtreecommitdiff
path: root/lua/telescope/actions
diff options
context:
space:
mode:
authorLuke Kershaw <35707277+l-kershaw@users.noreply.github.com>2022-01-15 22:27:03 +0000
committerGitHub <noreply@github.com>2022-01-15 22:27:03 +0000
commit2bfc0eb2cf12237eb0ac15498229341ededfaa0d (patch)
tree9cb6a9f7864db3936ba214b4920bff0da0c3db79 /lua/telescope/actions
parent860cc656632dbee8d817b1dfa5e6a5a73265286f (diff)
fix: update `multi_icon` with `select/drop/toggle_all` actions (#1682)
* fix: `multi_icon` with `select/drop/toggle_all` * typos * fix: add check for no caret found * fix: add check for no line found * fix: check `max_results` in `Picker:can_select_row` - also switch order of highlighting in `select/drop/toggle_all` actions * fix: make `max_results` check a strict inequality * [docgen] Update doc/telescope.txt skip-checks: true * fix: update `prompt_status` on `select/drop/toggle_all` actions Co-authored-by: Github Actions <actions@github>
Diffstat (limited to 'lua/telescope/actions')
-rw-r--r--lua/telescope/actions/init.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua
index 7ca47c7..1faaf30 100644
--- a/lua/telescope/actions/init.lua
+++ b/lua/telescope/actions/init.lua
@@ -113,10 +113,15 @@ function actions.select_all(prompt_bufnr)
if not current_picker._multi:is_selected(entry) then
current_picker._multi:add(entry)
if current_picker:can_select_row(row) then
+ local caret = current_picker:update_prefix(entry, row)
+ if current_picker._selection_entry == entry and current_picker._selection_row == row then
+ current_picker.highlighter:hi_selection(row, caret:match "(.*%S)")
+ end
current_picker.highlighter:hi_multiselect(row, current_picker._multi:is_selected(entry))
end
end
end)
+ current_picker:get_status_updater(current_picker.prompt_win, current_picker.prompt_bufnr)()
end
--- Drop all entries from the current multi selection.
@@ -126,9 +131,14 @@ function actions.drop_all(prompt_bufnr)
action_utils.map_entries(prompt_bufnr, function(entry, _, row)
current_picker._multi:drop(entry)
if current_picker:can_select_row(row) then
+ local caret = current_picker:update_prefix(entry, row)
+ if current_picker._selection_entry == entry and current_picker._selection_row == row then
+ current_picker.highlighter:hi_selection(row, caret:match "(.*%S)")
+ end
current_picker.highlighter:hi_multiselect(row, current_picker._multi:is_selected(entry))
end
end)
+ current_picker:get_status_updater(current_picker.prompt_win, current_picker.prompt_bufnr)()
end
--- Toggle multi selection for all entries.
@@ -139,9 +149,14 @@ function actions.toggle_all(prompt_bufnr)
action_utils.map_entries(prompt_bufnr, function(entry, _, row)
current_picker._multi:toggle(entry)
if current_picker:can_select_row(row) then
+ local caret = current_picker:update_prefix(entry, row)
+ if current_picker._selection_entry == entry and current_picker._selection_row == row then
+ current_picker.highlighter:hi_selection(row, caret:match "(.*%S)")
+ end
current_picker.highlighter:hi_multiselect(row, current_picker._multi:is_selected(entry))
end
end)
+ current_picker:get_status_updater(current_picker.prompt_win, current_picker.prompt_bufnr)()
end
function actions.preview_scrolling_up(prompt_bufnr)