@@ -290,6 +290,7 @@ local function update_draw_data(tree, depth, markers)
290
290
end
291
291
292
292
local git_hl = get_git_hl (node )
293
+ local filename_start_at
293
294
294
295
if node .entries then
295
296
local has_children = # node .entries ~= 0 or node .has_children
@@ -308,10 +309,15 @@ local function update_draw_data(tree, depth, markers)
308
309
if special [node .absolute_path ] then
309
310
folder_hl = " NvimTreeSpecialFolderName"
310
311
end
312
+ filename_start_at = offset +# git_icon +# icon
311
313
set_folder_hl (index , offset , # icon , # name +# git_icon , folder_hl )
312
314
if git_hl then
313
315
set_folder_hl (index , offset , # icon , # name +# git_icon , git_hl )
314
316
end
317
+ if node .marked then
318
+ table.insert (hl , { ' NvimTreeMarkedFile' , index , filename_start_at , - 1 })
319
+ end
320
+
315
321
index = index + 1
316
322
if node .open then
317
323
table.insert (lines , padding .. icon .. git_icon .. name .. (vim .g .nvim_tree_add_trailing == 1 and ' /' or ' ' ))
@@ -323,7 +329,8 @@ local function update_draw_data(tree, depth, markers)
323
329
local icon = get_symlink_icon ()
324
330
local link_hl = git_hl or ' NvimTreeSymlink'
325
331
local arrow = vim .g .nvim_tree_symlink_arrow or ' ➛ '
326
- table.insert (hl , { link_hl , index , offset , - 1 })
332
+ filename_start_at = offset
333
+ table.insert (hl , { link_hl , index , filename_start_at , - 1 })
327
334
table.insert (lines , padding .. icon .. node .name .. arrow .. node .link_to )
328
335
index = index + 1
329
336
@@ -340,10 +347,11 @@ local function update_draw_data(tree, depth, markers)
340
347
end
341
348
table.insert (lines , padding .. icon .. git_icons .. node .name )
342
349
350
+ filename_start_at = offset +# git_icons +# icon
343
351
if node .executable then
344
- table.insert (hl , {' NvimTreeExecFile' , index , offset +# icon +# git_icons , - 1 })
352
+ table.insert (hl , {' NvimTreeExecFile' , index , filename_start_at , - 1 })
345
353
elseif picture [node .extension ] then
346
- table.insert (hl , {' NvimTreeImageFile' , index , offset +# icon +# git_icons , - 1 })
354
+ table.insert (hl , {' NvimTreeImageFile' , index , filename_start_at , - 1 })
347
355
end
348
356
349
357
if should_hl_opened_files then
@@ -363,6 +371,9 @@ local function update_draw_data(tree, depth, markers)
363
371
end
364
372
index = index + 1
365
373
end
374
+ if not node .entries and node .marked then
375
+ table.insert (hl , { ' NvimTreeMarkedFile' , index - 1 , filename_start_at , - 1 })
376
+ end
366
377
end
367
378
end
368
379
0 commit comments