fix: error when adding files where root != cwd (#2233)

This commit is contained in:
Avinash Thakur
2025-06-17 13:38:15 +05:30
committed by GitHub
parent 2ed75a2f97
commit b52a89cb08
3 changed files with 27 additions and 32 deletions

View File

@@ -3088,9 +3088,11 @@ function Sidebar:create_selected_files_container()
local lines_to_set = {}
local highlights_to_apply = {}
local project_path = Utils.root.get()
for i, filepath in ipairs(selected_filepaths_) do
local icon, hl = Utils.file.get_file_icon(filepath)
local formatted_line = string.format("%s %s", icon, filepath)
local renderpath = PPath:new(filepath):normalize(project_path)
local formatted_line = string.format("%s %s", icon, renderpath)
table.insert(lines_to_set, formatted_line)
if hl and hl ~= "" then table.insert(highlights_to_apply, { line_nr = i, icon = icon, hl = hl }) end
end