fix(git): git folder fixes and improvements (#1809)

* coding style

* outlined git.show_on_open_dirs behavior

* show some icon on opendir even if show_on_open_dir=false

and show all children's status on parent

* fixed renamed icon not showing

* sorted icons

* removed DU from deleted as file will show up in tree

* fixed update_git_status in reloaders not tested

* fixed Api.git.reload()

Tested update_git_status in reloaders.lua

* sort icon only if not git signcolumn

* fixed crashing when root dir isn't git dir

* made git.show_on_dirs doc more concise

* git_statuses -> git_status for consistency

* explorer/common.lua -> explorer/node.lua

* fixed #1784 conflict

* don't order icons

* Revert "don't order icons"

This reverts commit 23f6276ef7.
This commit is contained in:
Richard Li
2022-12-17 19:05:33 +13:00
committed by GitHub
parent 89c79cb33b
commit 29788cc32a
13 changed files with 263 additions and 189 deletions

View File

@@ -250,10 +250,17 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
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