summaryrefslogtreecommitdiff
path: root/lua/telescope/pickers.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-08-29 22:15:40 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-08-29 22:15:40 -0400
commitae9b76929957a1eb20ea016c6ce9d34bc0d8b213 (patch)
tree4b129c1d53e9df1c7cb663a6bacb9b6dc84605d7 /lua/telescope/pickers.lua
parent711536859370510531744f6b239004a67c2e1a7e (diff)
feat: Add selection and start actions
Diffstat (limited to 'lua/telescope/pickers.lua')
-rw-r--r--lua/telescope/pickers.lua25
1 files changed, 22 insertions, 3 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index fc191bd..95476f1 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -193,6 +193,7 @@ function Picker:find(opts)
return
end
+ -- TODO: This really isn't the place to do this.
local display = entry.display
if has_devicons then
@@ -200,6 +201,8 @@ function Picker:find(opts)
display = (icon or ' ') .. ' ' .. display
end
+ display = ' ' .. display
+
-- log.info("Setting row", row, "with value", entry)
vim.api.nvim_buf_set_lines(results_bufnr, row, row + 1, false, {display})
end
@@ -388,17 +391,33 @@ function Picker:set_selection(row)
end
local status = state.get_status(self.prompt_bufnr)
+ local results_bufnr = status.results_bufnr
+
+ -- Handle adding '> ' to beginning of selections
+ if self._selection_row then
+ a.nvim_buf_set_lines(results_bufnr, self._selection_row, self._selection_row + 1, false, {' ' .. a.nvim_buf_get_lines(results_bufnr, self._selection_row, self._selection_row + 1, false)[1]:sub(3)})
+ end
+
+ a.nvim_buf_set_lines(results_bufnr, row, row + 1, false, {'> ' .. a.nvim_buf_get_lines(results_bufnr, row, row + 1, false)[1]:sub(3)})
- a.nvim_buf_clear_namespace(status.results_bufnr, ns_telescope_selection, 0, -1)
+ a.nvim_buf_clear_namespace(results_bufnr, ns_telescope_selection, 0, -1)
a.nvim_buf_add_highlight(
- status.results_bufnr,
+ results_bufnr,
ns_telescope_selection,
- 'Error',
+ 'TelescopeSelection',
row,
0,
-1
)
+
+ -- if self._match_id then
+ -- -- vim.fn.matchdelete(self._match_id)
+ -- vim.fn.clearmatches(results_win)
+ -- end
+
+ -- self._match_id = vim.fn.matchaddpos("Conceal", { {row + 1, 1, 2} }, 0, -1, { window = results_win, conceal = ">" })
+
-- TODO: Don't let you go over / under the buffer limits
-- TODO: Make sure you start exactly at the bottom selected