summaryrefslogtreecommitdiff
path: root/lua/telescope
diff options
context:
space:
mode:
authorLuke Kershaw <35707277+l-kershaw@users.noreply.github.com>2022-01-14 17:02:24 +0000
committerGitHub <noreply@github.com>2022-01-14 18:02:24 +0100
commite8ccd47c4f748a0db5c84c84e2bc7f518cb94cea (patch)
tree2fa15a10608cf76615c0350903a03cdf9c427cfc /lua/telescope
parent3bf4d4b4d075fb190edb9c19ac940f237a79a589 (diff)
feat: adds multiselect counter in prompt status_text (#1614)
Diffstat (limited to 'lua/telescope')
-rw-r--r--lua/telescope/config.lua7
-rw-r--r--lua/telescope/pickers.lua3
2 files changed, 9 insertions, 1 deletions
diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua
index 5bf8602..9d85305 100644
--- a/lua/telescope/config.lua
+++ b/lua/telescope/config.lua
@@ -363,6 +363,7 @@ append(
append(
"get_status_text",
function(self)
+ local ww = #(self:get_multi_selection())
local xx = (self.stats.processed or 0) - (self.stats.filtered or 0)
local yy = self.stats.processed or 0
if xx == 0 and yy == 0 then
@@ -375,7 +376,11 @@ append(
-- else
-- status_icon = "*"
-- end
- return string.format("%s / %s", xx, yy)
+ if ww == 0 then
+ return string.format("%s / %s", xx, yy)
+ else
+ return string.format("%s / %s / %s", ww, xx, yy)
+ end
end,
[[
A function that determines what the virtual text looks like.
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index 6e966a5..7fad903 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -766,6 +766,7 @@ function Picker:add_selection(row)
local entry = self.manager:get_entry(self:get_index(row))
self._multi:add(entry)
+ self:get_status_updater(self.prompt_win, self.prompt_bufnr)()
self.highlighter:hi_multiselect(row, true)
end
@@ -775,6 +776,7 @@ function Picker:remove_selection(row)
local entry = self.manager:get_entry(self:get_index(row))
self._multi:drop(entry)
+ self:get_status_updater(self.prompt_win, self.prompt_bufnr)()
self.highlighter:hi_multiselect(row, false)
end
@@ -799,6 +801,7 @@ function Picker:toggle_selection(row)
local entry = self.manager:get_entry(self:get_index(row))
self._multi:toggle(entry)
+ self:get_status_updater(self.prompt_win, self.prompt_bufnr)()
self.highlighter:hi_multiselect(row, self._multi:is_selected(entry))
end