committed by
GitHub
parent
48b1d8638f
commit
7bdb220d0f
@@ -1,41 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
---@type table<string, boolean> record of which file is modified
|
||||
M._record = {}
|
||||
|
||||
---refresh M.record
|
||||
function M.reload()
|
||||
M._record = {}
|
||||
local bufs = vim.fn.getbufinfo { bufmodified = true, buflisted = true }
|
||||
for _, buf in pairs(bufs) do
|
||||
local path = buf.name
|
||||
if path ~= "" then -- not a [No Name] buffer
|
||||
-- mark all the parent as modified as well
|
||||
while
|
||||
M._record[path] ~= true
|
||||
-- no need to keep going if already recorded
|
||||
-- This also prevents an infinite loop
|
||||
do
|
||||
M._record[path] = true
|
||||
path = vim.fn.fnamemodify(path, ":h")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@param node Node
|
||||
---@return boolean
|
||||
function M.is_modified(node)
|
||||
return node
|
||||
and M.config.enable
|
||||
and M._record[node.absolute_path]
|
||||
and (not node.nodes or M.config.show_on_dirs)
|
||||
and (not node.open or M.config.show_on_open_dirs)
|
||||
end
|
||||
|
||||
---@param opts table
|
||||
function M.setup(opts)
|
||||
M.config = opts.modified
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -4,7 +4,6 @@ local live_filter = require "nvim-tree.live-filter"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local view = require "nvim-tree.view"
|
||||
local log = require "nvim-tree.log"
|
||||
|
||||
local DecoratorBookmarks = require "nvim-tree.renderer.decorator.bookmarks"
|
||||
local DecoratorCopied = require "nvim-tree.renderer.decorator.copied"
|
||||
@@ -230,7 +229,6 @@ function Builder:format_line(indent_markers, arrows, icon, name, node)
|
||||
add_to_end(line, M.decorators[i]:icons_after(node))
|
||||
end
|
||||
|
||||
log.line("dev", "line = %s", vim.inspect(line))
|
||||
return line
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user