11local utils = require " nvim-tree.utils"
22local core = require " nvim-tree.core"
3+ local modified = require " nvim-tree.modified"
34
45local git = require " nvim-tree.renderer.components.git"
56local pad = require " nvim-tree.renderer.components.padding"
@@ -68,10 +69,11 @@ function Builder:configure_git_icons_placement(where)
6869 return self
6970end
7071
71- function Builder :configure_modified (modified_icon , modified_placement , modified )
72- self .modified = modified
73- self .modified .icon = modified_icon
74- self .modified .placement = modified_placement
72+ function Builder :configure_modified (modified_icon , modified_placement )
73+ self .modified = {
74+ icon = modified_icon ,
75+ placement = modified_placement ,
76+ }
7577 return self
7678end
7779
@@ -118,6 +120,9 @@ function Builder:_build_folder(node, padding, git_hl, git_icons_tbl)
118120 local offset = string.len (padding )
119121
120122 local name = get_folder_name (node )
123+ if modified .is_modified (node ) then
124+ name = name .. self .modified .icon
125+ end
121126 local has_children = # node .nodes ~= 0 or node .has_children
122127 local icon = icons .get_folder_icon (node .open , node .link_to ~= nil , has_children )
123128
@@ -213,7 +218,7 @@ function Builder:_highlight_opened_files(node, offset, icon_length, git_icons_le
213218 self :_insert_highlight (" NvimTreeOpenedFile" , from , to )
214219end
215220
216- function Builder :_build_file (node , padding , git_highlight , git_icons_tbl , unloaded_bufnr , modified )
221+ function Builder :_build_file (node , padding , git_highlight , git_icons_tbl , unloaded_bufnr )
217222 local offset = string.len (padding )
218223
219224 local icon = self :_build_file_icon (node , offset )
@@ -222,7 +227,7 @@ function Builder:_build_file(node, padding, git_highlight, git_icons_tbl, unload
222227 local git_icons = self :_unwrap_git_data (git_icons_tbl , git_icons_starts_at )
223228
224229 local name = node .name
225- if modified then
230+ if modified . is_modified ( node ) then
226231 name = name .. self .modified .icon
227232 end
228233 self :_insert_line (self :_format_line (padding .. icon , name , git_icons ))
@@ -274,8 +279,6 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
274279 end
275280 end
276281
277- local modified = vim .fn .bufloaded (node .absolute_path ) > 0 and vim .fn .getbufinfo (node .absolute_path )[1 ].changed == 1
278-
279282 local is_folder = node .nodes ~= nil
280283 local is_symlink = node .link_to ~= nil
281284
@@ -284,7 +287,7 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
284287 elseif is_symlink then
285288 self :_build_symlink (node , padding , git_highlight , git_icons_tbl )
286289 else
287- self :_build_file (node , padding , git_highlight , git_icons_tbl , unloaded_bufnr , modified )
290+ self :_build_file (node , padding , git_highlight , git_icons_tbl , unloaded_bufnr )
288291 end
289292 self .index = self .index + 1
290293
0 commit comments