From c7d9b4d77e39c2790c1acace096e8c739da81c08 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 11 Feb 2024 15:39:07 +1100 Subject: [PATCH] fix(#2415): highlight help header and mappings --- lua/nvim-tree/help.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/help.lua b/lua/nvim-tree/help.lua index 2f2c9d8c017..3fa63cfe70e 100644 --- a/lua/nvim-tree/help.lua +++ b/lua/nvim-tree/help.lua @@ -119,14 +119,20 @@ local function compute() -- increase desc if lines are shorter than the header max_desc = math.max(max_desc, #head_lhs + #head_rhs1 - max_lhs) - -- header, not padded - local hl = { { "NvimTreeRootFolder", 0, 0, #head_lhs } } + -- header text, not padded local lines = { head_lhs .. string.rep(" ", max_desc + max_lhs - #head_lhs - #head_rhs1 + 2) .. head_rhs1, string.rep(" ", max_desc + max_lhs - #head_rhs2 + 2) .. head_rhs2, } local width = #lines[1] + -- header highlight, assume one character keys + local hl = { + { "NvimTreeFolderName", 0, 0, #head_lhs }, + { "NvimTreeFolderName", 0, width - 1, width }, + { "NvimTreeFolderName", 1, width - 1, width }, + } + -- mappings, left padded 1 local fmt = string.format(" %%-%ds %%-%ds", max_lhs, max_desc) for i, l in ipairs(mappings) do