Skip to content

Commit cdbd7da

Browse files
authored
fix(#1878): nvim frozen on no name buffer when modified.enable (#1879)
1 parent 951b6e7 commit cdbd7da

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lua/nvim-tree/modified.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ function M.reload()
99
local bufs = vim.fn.getbufinfo { bufmodified = true, buflisted = true }
1010
for _, buf in pairs(bufs) do
1111
local path = buf.name
12-
M._record[path] = true
13-
while path ~= vim.fn.getcwd() and path ~= "/" do
14-
path = vim.fn.fnamemodify(path, ":h")
15-
M._record[path] = true
12+
if path ~= "" then -- not a [No Name] buffer
13+
-- mark all the parent as modified as well
14+
while
15+
M._record[path] ~= true
16+
-- no need to keep going if already recorded
17+
-- This also prevents an infinite loop
18+
do
19+
M._record[path] = true
20+
path = vim.fn.fnamemodify(path, ":h")
21+
end
1622
end
1723
end
1824
end

0 commit comments

Comments
 (0)