Skip to content

Commit cc65530

Browse files
committed
feat(#2415): create DecoratorGit
1 parent 3376e77 commit cc65530

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
@@ -63,14 +63,6 @@ function Builder:configure_icon_padding(padding)
6363
return self
6464
end
6565

66-
function Builder:configure_git_icons_placement(where)
67-
if where ~= "after" and where ~= "before" and where ~= "signcolumn" then
68-
where = "before" -- default before
69-
end
70-
self.git_placement = where
71-
return self
72-
end
73-
7466
function Builder:configure_symlink_destination(show)
7567
self.symlink_destination = show
7668
return self
@@ -194,7 +186,7 @@ end
194186
---@return HighlightedString[]|nil icon
195187
function Builder:_get_git_icons(node)
196188
local git_icons = self.decorators.git:get_icons(node)
197-
if git_icons and #git_icons > 0 and self.git_placement == "signcolumn" then
189+
if git_icons and #git_icons > 0 and self.decorators.git.icon_placement == ICON_PLACEMENT.signcolumn then
198190
table.insert(self.signs, {
199191
sign = git_icons[1].hl[1],
200192
lnum = self.index + 1,
@@ -331,7 +323,7 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
331323

332324
local line = { indent_markers, arrows }
333325
add_to_end(line, { icon })
334-
if git_icons and self.git_placement == "before" then
326+
if git_icons and self.decorators.git.icon_placement == ICON_PLACEMENT.before then
335327
add_to_end(line, git_icons)
336328
end
337329
if modified_icon and self.decorators.modified.icon_placement == ICON_PLACEMENT.before then
@@ -346,7 +338,7 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
346338

347339
add_to_end(line, { name })
348340

349-
if git_icons and self.git_placement == "after" then
341+
if git_icons and self.decorators.git.icon_placement == ICON_PLACEMENT.after then
350342
add_to_end(line, git_icons)
351343
end
352344
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
:build_header(view.is_root_folder_visible(core.get_cwd()))

0 commit comments

Comments
 (0)