sort icon only if not git signcolumn

This commit is contained in:
chomosuke
2022-12-06 23:56:12 +11:00
parent 3af4d14199
commit 10fc0ebf90
2 changed files with 11 additions and 8 deletions

View File

@@ -248,10 +248,17 @@ function Builder:_build_line(node, idx, num_children)
local git_highlight = git.get_highlight(node)
local git_icons_tbl = git.get_icons(node)
if self.is_git_sign and git_icons_tbl and #git_icons_tbl > 0 then
local git_info = git_icons_tbl[1]
table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 })
git_icons_tbl = {}
if git_icons_tbl and #git_icons_tbl > 0 then
if self.is_git_sign then
local git_info = git_icons_tbl[1]
table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 })
git_icons_tbl = {}
else
-- sort icons so it looks slightly better
table.sort(git_icons_tbl, function(a, b)
return a.ord < b.ord
end)
end
end
local is_folder = node.nodes ~= nil

View File

@@ -85,10 +85,6 @@ local function get_icons_(node)
end
end
table.sort(iconss, function(a, b)
return a.ord < b.ord
end)
return iconss
end