36
36
--- Write the line with highlighting
37
37
--- @param bufnr number buffer number
38
38
--- @param max_tag_len number longest tag length
39
- --- @param max_name_len number longest name length
39
+ --- @param max_group_len number longest group length
40
40
--- @param l number line number
41
41
--- @return number l incremented
42
- function IconDisplay :render (bufnr , max_tag_len , max_name_len , l )
43
- local fmt = string.format (" %%s %%-%d.%ds %%-%d.%ds %%s" , max_name_len , max_name_len , max_tag_len , max_tag_len )
44
- local text = string.format (fmt , self .icon , self .name , self .tag , self .def )
42
+ function IconDisplay :render (bufnr , max_tag_len , max_group_len , l )
43
+ local fmt = string.format (" %%s %%-%d.%ds %%-%d.%ds %%s" , max_tag_len , max_tag_len , max_group_len , max_group_len )
44
+ local text = string.format (fmt , self .icon , self .tag , self .group , self .def )
45
45
46
46
vim .api .nvim_buf_set_lines (bufnr , l , - 1 , true , { text })
47
47
vim .api .nvim_buf_add_highlight (bufnr , - 1 , self .group , l , 0 , - 1 )
66
66
--- @return number l incremented
67
67
local function render_icons (bufnr , l , icons , header )
68
68
local max_tag_len = 0
69
- local max_name_len = 0
69
+ local max_group_len = 0
70
70
71
71
local displays = {}
72
72
--- @cast displays IconDisplay[]
@@ -77,7 +77,7 @@ local function render_icons(bufnr, l, icons, header)
77
77
if display then
78
78
table.insert (displays , display )
79
79
max_tag_len = math.max (max_tag_len , # display .tag )
80
- max_name_len = math.max (max_name_len , # display .name )
80
+ max_group_len = math.max (max_group_len , # display .group )
81
81
end
82
82
end
83
83
@@ -89,7 +89,7 @@ local function render_icons(bufnr, l, icons, header)
89
89
l = render_line (bufnr , l , header )
90
90
l = render_line (bufnr , l , header :gsub (" ." , " -" ))
91
91
for _ , display in ipairs (displays ) do
92
- l = display :render (bufnr , max_tag_len , max_name_len , l )
92
+ l = display :render (bufnr , max_tag_len , max_group_len , l )
93
93
end
94
94
l = render_line (bufnr , l , " " )
95
95
@@ -120,7 +120,7 @@ return function(
120
120
121
121
-- render and highlight each section
122
122
local l = 0
123
- l = render_icons (bufnr , l , { default_icon }, " Default" )
123
+ l = render_icons (bufnr , l , { [ " " ] = default_icon }, " Default" )
124
124
if global_override and next (global_override ) then
125
125
l = render_icons (bufnr , l , global_override , " Overrides" )
126
126
end
0 commit comments