Enhance: Truncate from section c this way a&b won't disapear when stl becomes wide

This commit is contained in:
shadmansaleh 2021-08-28 01:06:19 +06:00
parent 276ba5d19e
commit 6c9330d240
1 changed files with 5 additions and 0 deletions

View File

@ -103,6 +103,7 @@ local function statusline(sections, is_focused)
local section_sequence = {'a', 'b', 'c', 'x', 'y', 'z'} local section_sequence = {'a', 'b', 'c', 'x', 'y', 'z'}
local status = {} local status = {}
local applied_midsection_devider = false local applied_midsection_devider = false
local applied_trunc = false
for _, section_name in ipairs(section_sequence) do for _, section_name in ipairs(section_sequence) do
if sections['lualine_' .. section_name] then if sections['lualine_' .. section_name] then
-- insert highlight+components of this section to status_builder -- insert highlight+components of this section to status_builder
@ -114,6 +115,10 @@ local function statusline(sections, is_focused)
applied_midsection_devider = true applied_midsection_devider = true
section_data = '%='..section_data section_data = '%='..section_data
end end
if not applied_trunc and section_name > 'b' then
applied_trunc = true
section_data = '%<'..section_data
end
table.insert(status, section_data) table.insert(status, section_data)
end end
end end