@@ -310,6 +310,7 @@ local function update_draw_data(tree, depth, markers)
310
310
end
311
311
312
312
local git_hl = get_git_hl (node )
313
+ local filename_start_at
313
314
314
315
if node .entries then
315
316
local has_children = # node .entries ~= 0 or node .has_children
@@ -325,10 +326,15 @@ local function update_draw_data(tree, depth, markers)
325
326
end
326
327
if not has_children then folder_hl = " NvimTreeEmptyFolderName" end
327
328
if node .open then folder_hl = " NvimTreeOpenedFolderName" end
329
+ filename_start_at = offset +# git_icon +# icon
328
330
set_folder_hl (index , offset , # icon , # name +# git_icon , folder_hl )
329
331
if git_hl then
330
332
set_folder_hl (index , offset , # icon , # name +# git_icon , git_hl )
331
333
end
334
+ if node .marked then
335
+ table.insert (hl , { ' NvimTreeMarkedFile' , index , filename_start_at , - 1 })
336
+ end
337
+
332
338
index = index + 1
333
339
if node .open then
334
340
table.insert (lines , padding .. icon .. git_icon .. name .. (vim .g .nvim_tree_add_trailing == 1 and ' /' or ' ' ))
@@ -340,7 +346,8 @@ local function update_draw_data(tree, depth, markers)
340
346
local icon = get_symlink_icon ()
341
347
local link_hl = git_hl or ' NvimTreeSymlink'
342
348
local arrow = vim .g .nvim_tree_symlink_arrow or ' ➛ '
343
- table.insert (hl , { link_hl , index , offset , - 1 })
349
+ filename_start_at = offset
350
+ table.insert (hl , { link_hl , index , filename_start_at , - 1 })
344
351
table.insert (lines , padding .. icon .. node .name .. arrow .. node .link_to )
345
352
index = index + 1
346
353
@@ -357,10 +364,11 @@ local function update_draw_data(tree, depth, markers)
357
364
end
358
365
table.insert (lines , padding .. icon .. git_icons .. node .name )
359
366
367
+ filename_start_at = offset +# git_icons +# icon
360
368
if node .executable then
361
- table.insert (hl , {' NvimTreeExecFile' , index , offset +# icon +# git_icons , - 1 })
369
+ table.insert (hl , {' NvimTreeExecFile' , index , filename_start_at , - 1 })
362
370
elseif picture [node .extension ] then
363
- table.insert (hl , {' NvimTreeImageFile' , index , offset +# icon +# git_icons , - 1 })
371
+ table.insert (hl , {' NvimTreeImageFile' , index , filename_start_at , - 1 })
364
372
end
365
373
366
374
if should_hl_opened_files then
@@ -380,6 +388,9 @@ local function update_draw_data(tree, depth, markers)
380
388
end
381
389
index = index + 1
382
390
end
391
+ if not node .entries and node .marked then
392
+ table.insert (hl , { ' NvimTreeMarkedFile' , index - 1 , filename_start_at , - 1 })
393
+ end
383
394
end
384
395
end
385
396
0 commit comments