@@ -276,6 +276,7 @@ local function update_draw_data(tree, depth, markers)
276
276
end
277
277
278
278
local git_hl = get_git_hl (node )
279
+ local filename_start_at
279
280
280
281
if node .entries then
281
282
local has_children = # node .entries ~= 0 or node .has_children
@@ -291,10 +292,15 @@ local function update_draw_data(tree, depth, markers)
291
292
end
292
293
if not has_children then folder_hl = " NvimTreeEmptyFolderName" end
293
294
if node .open then folder_hl = " NvimTreeOpenedFolderName" end
295
+ filename_start_at = offset +# git_icon +# icon
294
296
set_folder_hl (index , offset , # icon , # name +# git_icon , folder_hl )
295
297
if git_hl then
296
298
set_folder_hl (index , offset , # icon , # name +# git_icon , git_hl )
297
299
end
300
+ if node .marked then
301
+ table.insert (hl , { ' NvimTreeMarkedFile' , index , filename_start_at , - 1 })
302
+ end
303
+
298
304
index = index + 1
299
305
if node .open then
300
306
table.insert (lines , padding .. icon .. git_icon .. name .. (vim .g .nvim_tree_add_trailing == 1 and ' /' or ' ' ))
@@ -306,7 +312,8 @@ local function update_draw_data(tree, depth, markers)
306
312
local icon = get_symlink_icon ()
307
313
local link_hl = git_hl or ' NvimTreeSymlink'
308
314
local arrow = vim .g .nvim_tree_symlink_arrow or ' ➛ '
309
- table.insert (hl , { link_hl , index , offset , - 1 })
315
+ filename_start_at = offset
316
+ table.insert (hl , { link_hl , index , filename_start_at , - 1 })
310
317
table.insert (lines , padding .. icon .. node .name .. arrow .. node .link_to )
311
318
index = index + 1
312
319
@@ -323,10 +330,11 @@ local function update_draw_data(tree, depth, markers)
323
330
end
324
331
table.insert (lines , padding .. icon .. git_icons .. node .name )
325
332
333
+ filename_start_at = offset +# git_icons +# icon
326
334
if node .executable then
327
- table.insert (hl , {' NvimTreeExecFile' , index , offset +# icon +# git_icons , - 1 })
335
+ table.insert (hl , {' NvimTreeExecFile' , index , filename_start_at , - 1 })
328
336
elseif picture [node .extension ] then
329
- table.insert (hl , {' NvimTreeImageFile' , index , offset +# icon +# git_icons , - 1 })
337
+ table.insert (hl , {' NvimTreeImageFile' , index , filename_start_at , - 1 })
330
338
end
331
339
332
340
if should_hl_opened_files then
@@ -346,6 +354,9 @@ local function update_draw_data(tree, depth, markers)
346
354
end
347
355
index = index + 1
348
356
end
357
+ if not node .entries and node .marked then
358
+ table.insert (hl , { ' NvimTreeMarkedFile' , index - 1 , filename_start_at , - 1 })
359
+ end
349
360
end
350
361
end
351
362
0 commit comments