fix: icon hl width for various pickers (#2450)

(cherry picked from commit c20d4fb592)
This commit is contained in:
James Trew
2023-04-09 04:04:20 -04:00
committed by Simon Hauser
parent 597c10f5b1
commit 54fc54fdd3
2 changed files with 9 additions and 8 deletions
+5 -5
View File
@@ -157,13 +157,13 @@ do
mt_file_entry.cwd = cwd
mt_file_entry.display = function(entry)
local hl_group
local hl_group, icon
local display = utils.transform_path(opts, entry.value)
display, hl_group = utils.transform_devicons(entry.value, display, disable_devicons)
display, hl_group, icon = utils.transform_devicons(entry.value, display, disable_devicons)
if hl_group then
return display, { { { 1, 3 }, hl_group } }
return display, { { { 1, #icon }, hl_group } }
else
return display
end
@@ -319,14 +319,14 @@ do
end
end
local display, hl_group = utils.transform_devicons(
local display, hl_group, icon = utils.transform_devicons(
entry.filename,
string.format(display_string, display_filename, coordinates, entry.text),
disable_devicons
)
if hl_group then
return display, { { { 1, 3 }, hl_group } }
return display, { { { 1, #icon }, hl_group } }
else
return display
end
+4 -3
View File
@@ -460,13 +460,14 @@ utils.transform_devicons = load_once(function()
local icon, icon_highlight = devicons.get_icon(basename, utils.file_extension(basename), { default = false })
if not icon then
icon, icon_highlight = devicons.get_icon(basename, nil, { default = true })
icon = icon or " "
end
local icon_display = (icon or " ") .. " " .. (display or "")
local icon_display = icon .. " " .. (display or "")
if conf.color_devicons then
return icon_display, icon_highlight
return icon_display, icon_highlight, icon
else
return icon_display, nil
return icon_display, nil, icon
end
end
else