Skip to content

Commit e8ccd47

Browse files
authored
feat: adds multiselect counter in prompt status_text (#1614)
1 parent 3bf4d4b commit e8ccd47

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lua/telescope/config.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ append(
363363
append(
364364
"get_status_text",
365365
function(self)
366+
local ww = #(self:get_multi_selection())
366367
local xx = (self.stats.processed or 0) - (self.stats.filtered or 0)
367368
local yy = self.stats.processed or 0
368369
if xx == 0 and yy == 0 then
@@ -375,7 +376,11 @@ append(
375376
-- else
376377
-- status_icon = "*"
377378
-- end
378-
return string.format("%s / %s", xx, yy)
379+
if ww == 0 then
380+
return string.format("%s / %s", xx, yy)
381+
else
382+
return string.format("%s / %s / %s", ww, xx, yy)
383+
end
379384
end,
380385
[[
381386
A function that determines what the virtual text looks like.

lua/telescope/pickers.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ function Picker:add_selection(row)
766766
local entry = self.manager:get_entry(self:get_index(row))
767767
self._multi:add(entry)
768768

769+
self:get_status_updater(self.prompt_win, self.prompt_bufnr)()
769770
self.highlighter:hi_multiselect(row, true)
770771
end
771772

@@ -775,6 +776,7 @@ function Picker:remove_selection(row)
775776
local entry = self.manager:get_entry(self:get_index(row))
776777
self._multi:drop(entry)
777778

779+
self:get_status_updater(self.prompt_win, self.prompt_bufnr)()
778780
self.highlighter:hi_multiselect(row, false)
779781
end
780782

@@ -799,6 +801,7 @@ function Picker:toggle_selection(row)
799801
local entry = self.manager:get_entry(self:get_index(row))
800802
self._multi:toggle(entry)
801803

804+
self:get_status_updater(self.prompt_win, self.prompt_bufnr)()
802805
self.highlighter:hi_multiselect(row, self._multi:is_selected(entry))
803806
end
804807

0 commit comments

Comments
 (0)