Skip to content

Commit 3f128e3

Browse files
committed
feat(#2415): create DecoratorGit
1 parent f9be511 commit 3f128e3

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

lua/nvim-tree/renderer/builder.lua

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ function Builder:configure_icon_padding(padding)
6464
return self
6565
end
6666

67-
function Builder:configure_git_icons_placement(where)
68-
if where ~= "after" and where ~= "before" and where ~= "signcolumn" then
69-
where = "before" -- default before
70-
end
71-
self.git_placement = where
72-
return self
73-
end
74-
7567
function Builder:configure_symlink_destination(show)
7668
self.symlink_destination = show
7769
return self
@@ -212,7 +204,7 @@ end
212204
---@return HighlightedString[]|nil icon
213205
function Builder:_get_git_icons(node)
214206
local git_icons = self.decorators.git:get_icons(node)
215-
if git_icons and #git_icons > 0 and self.git_placement == "signcolumn" then
207+
if git_icons and #git_icons > 0 and self.decorators.git.icon_placement == ICON_PLACEMENT.signcolumn then
216208
table.insert(self.signs, {
217209
sign = git_icons[1].hl[1],
218210
lnum = self.index + 1,
@@ -349,7 +341,7 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
349341

350342
local line = { indent_markers, arrows }
351343
add_to_end(line, { icon })
352-
if git_icons and self.git_placement == "before" then
344+
if git_icons and self.decorators.git.icon_placement == ICON_PLACEMENT.before then
353345
add_to_end(line, git_icons)
354346
end
355347
if modified_icon and self.decorators.modified.icon_placement == ICON_PLACEMENT.before then
@@ -364,7 +356,7 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
364356

365357
add_to_end(line, { name })
366358

367-
if git_icons and self.git_placement == "after" then
359+
if git_icons and self.decorators.git.icon_placement == ICON_PLACEMENT.after then
368360
add_to_end(line, git_icons)
369361
end
370362
if modified_icon and self.decorators.modified.icon_placement == ICON_PLACEMENT.after then

lua/nvim-tree/renderer/init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ function M.draw(unloaded_bufnr)
7575
:configure_picture_map(picture_map)
7676
:configure_opened_file_highlighting(M.config.highlight_opened_files)
7777
:configure_icon_padding(M.config.icons.padding)
78-
:configure_git_icons_placement(M.config.icons.git_placement)
7978
:configure_symlink_destination(M.config.symlink_destination)
8079
:configure_filter(live_filter.filter, live_filter.prefix)
8180
:configure_group_name_modifier(M.config.group_empty)

0 commit comments

Comments
 (0)