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