fix: nil error with Alpha on buffers component

This commit is contained in:
shadmansaleh 2021-09-20 21:47:25 +06:00
parent 904f9df637
commit cdc574c9b0
3 changed files with 9 additions and 2 deletions

View File

@ -385,6 +385,7 @@ sections = {
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha'
}, -- shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
buffers_color = {
active = nil, -- color for active buffer

View File

@ -364,6 +364,7 @@ Component specific local options ~
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha'
}, -- shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
buffers_color = {
active = nil, -- color for active buffer

View File

@ -12,6 +12,7 @@ local default_options = {
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha',
},
}
@ -197,12 +198,16 @@ function Buffers:update_status()
b.current = true
if self.options.self.section < 'lualine_x' then
b.last = true
buffers[#buffers].last = nil
if #buffers > 0 then
buffers[#buffers].last = nil
end
buffers[#buffers + 1] = b
current = #buffers
else
b.first = true
buffers[1].first = nil
if #buffers > 0 then
buffers[1].first = nil
end
table.insert(buffers, 1, b)
current = 1
end