feat: show the count of selected files (#2250)
* feat: show the count of selected files * fix spaces * tweak title
This commit is contained in:
@@ -3098,6 +3098,7 @@ function Sidebar:create_selected_files_container()
|
|||||||
if hl and hl ~= "" then table.insert(highlights_to_apply, { line_nr = i, icon = icon, hl = hl }) end
|
if hl and hl ~= "" then table.insert(highlights_to_apply, { line_nr = i, icon = icon, hl = hl }) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local selected_files_count = #lines_to_set ---@type integer
|
||||||
local selected_files_buf = api.nvim_win_get_buf(self.selected_files_container.winid)
|
local selected_files_buf = api.nvim_win_get_buf(self.selected_files_container.winid)
|
||||||
Utils.unlock_buf(selected_files_buf)
|
Utils.unlock_buf(selected_files_buf)
|
||||||
api.nvim_buf_clear_namespace(selected_files_buf, SELECTED_FILES_ICON_NAMESPACE, 0, -1)
|
api.nvim_buf_clear_namespace(selected_files_buf, SELECTED_FILES_ICON_NAMESPACE, 0, -1)
|
||||||
@@ -3119,7 +3120,12 @@ function Sidebar:create_selected_files_container()
|
|||||||
self:render_header(
|
self:render_header(
|
||||||
self.selected_files_container.winid,
|
self.selected_files_container.winid,
|
||||||
selected_files_buf,
|
selected_files_buf,
|
||||||
Utils.icon(" ") .. "Selected Files",
|
string.format(
|
||||||
|
"%sSelected (%d file%s)",
|
||||||
|
Utils.icon(" "),
|
||||||
|
selected_files_count,
|
||||||
|
selected_files_count > 1 and "s" or ""
|
||||||
|
),
|
||||||
Highlights.SUBTITLE,
|
Highlights.SUBTITLE,
|
||||||
Highlights.REVERSED_SUBTITLE
|
Highlights.REVERSED_SUBTITLE
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user