feat: multi selection. Only integrates with send_selected_to_qflist (#551)
This will not yet work with select actions. More work is needed in that case. Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
local a = vim.api
|
||||
local log = require('telescope.log')
|
||||
|
||||
local highlights = {}
|
||||
|
||||
@@ -76,25 +77,30 @@ function Highlighter:hi_selection(row, caret)
|
||||
)
|
||||
end
|
||||
|
||||
function Highlighter:hi_multiselect(row, entry)
|
||||
function Highlighter:hi_multiselect(row, is_selected)
|
||||
local results_bufnr = assert(self.picker.results_bufnr, "Must have a results bufnr")
|
||||
|
||||
if self.picker.multi_select[entry] then
|
||||
if is_selected then
|
||||
vim.api.nvim_buf_add_highlight(
|
||||
results_bufnr,
|
||||
ns_telescope_multiselection,
|
||||
"TelescopeMultiSelection",
|
||||
row,
|
||||
0,
|
||||
-1
|
||||
results_bufnr, ns_telescope_multiselection, "TelescopeMultiSelection", row, 0, -1
|
||||
)
|
||||
else
|
||||
vim.api.nvim_buf_clear_namespace(
|
||||
results_bufnr,
|
||||
ns_telescope_multiselection,
|
||||
row,
|
||||
row + 1
|
||||
local existing_marks = vim.api.nvim_buf_get_extmarks(
|
||||
results_bufnr, ns_telescope_multiselection, {row, 0}, {row, -1}, {}
|
||||
)
|
||||
|
||||
-- This is still kind of weird to me, since it seems like I'm erasing stuff
|
||||
-- when i shouldn't... perhaps it's a bout the gravity of the extmark?
|
||||
if #existing_marks > 0 then
|
||||
log.trace("Clearning row: ", row)
|
||||
|
||||
vim.api.nvim_buf_clear_namespace(
|
||||
results_bufnr,
|
||||
ns_telescope_multiselection,
|
||||
row,
|
||||
row + 1
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user