Skip to content

Commit

Permalink
refactor(menu): clean up dropbar_menu_t:fill_buf()
Browse files Browse the repository at this point in the history
  • Loading branch information
Bekaboo committed Jan 19, 2025
1 parent 75c5846 commit 8254df8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lua/dropbar/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,13 @@ function dropbar_menu_t:fill_buf()
-- the entire line
-- Also pad the last symbol's name so that cursor is always
-- on at least one symbol when inside the menu
local width_diff = self._win_configs.width - entry:displaywidth()
if width_diff > 0 then
local width_pad = string.rep(' ', width_diff)
local num_components = #entry.components
if num_components > 0 then
local last_sym = entry.components[num_components]
last_sym.name = last_sym.name .. width_pad
local n = self._win_configs.width - entry:displaywidth()
if n > 0 then
local last_sym = entry.components[#entry.components]
if last_sym then
last_sym.name = last_sym.name .. string.rep(' ', n)
end
line = line .. width_pad
line = line .. string.rep(' ', n)
end
table.insert(lines, line)
table.insert(hl_info, entry_hl_info)
Expand Down

0 comments on commit 8254df8

Please sign in to comment.