nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
5.89k stars 459 forks source link

Bug: separators always disappear when setting custom theme #885

Closed ExpandingMan closed 1 year ago

ExpandingMan commented 1 year ago

Self Checks

How to reproduce the problem

local Lualine = require("lualine")

local theme = {
    normal = {
        a = {bg=colors.bgdark, fg=colors.foreground},
        b = {bg=colors.bgdark, fg=colors.foreground},
        c = {bg=colors.bgdark, fg=colors.foreground},
    },
    insert = {
        a = {bg=colors.bgdark, fg=colors.green},
    },
    visual = {
        a = {bg=colors.bgdark, fg=colors.orange},
    },
    replace = {
        a = {bg=colors.bgdark, fg=colors.red},
    },
    command = {
        a = {bg=colors.bgdark, fg=colors.cyan},
    },
    inactive = {
        a = {bg=colors.bgdark, fg=colors.comment},
    },
}

local mode_component = {
    "mode",
    icons_enabled = true,
    fmt = function(o)
        return "▮"..string.lower(o).."▮"
    end,
    separator = {left="◖", right="◗"},
    padding = 1,
}

local config = {
    options = {
        icons_enabled = true,
        theme = theme,
        component_separators = { left = "◗", right = "◖"},
        section_separators = { left = "▮◗", right = "◖▮"},
        disabled_filetypes = {
            statusline = {},
            winbar = {},
        },
        ignore_focus = {},
        always_divide_middle = true,
        globalstatus = false,
        refresh = {
            statusline = 1000,
            tabline = 1000,
            winbar = 1000,
        }
    },
    sections = {
        lualine_a = {mode_component},
        lualine_b = {'branch', 'diff', 'diagnostics'},
        lualine_c = {'filename'},
        lualine_x = {'encoding', 'fileformat', 'filetype'},
        lualine_y = {'progress'},
        lualine_z = {'location'}
    },
    inactive_sections = {
        lualine_a = {},
        lualine_b = {},
        lualine_c = {'filename'},
        lualine_x = {'location'},
        lualine_y = {},
        lualine_z = {}
    },
    tabline = {},
    winbar = {},
    inactive_winbar = {},
    extensions = {}
}

Lualine.setup(config)

Expected behaviour

No separators display seemingly regardless of separator options any time a custom theme is defined.

Actual behaviour

No visible separators.

Minimal config to reproduce the issue

(see above)

Additional Comments

This seems like it would be such an obvious issue that I suspect I'm just not understanding the intended behavior, but for the life of me I can't get the separators to show up.

shadmansaleh commented 1 year ago

What are the colors in the theme? Section separators can't be displayed if the background color of the component before and after the separator are same. It's an intentional behavior if that's the case with your theme.

ExpandingMan commented 1 year ago

Oh... yes, that is indeed the case.

Is there an easy way to get it to show separators when the background is the same? This would make it much easier to handle the colors, otherwise it will be tricky to get it to show separators that are a different color from the components.

ExpandingMan commented 1 year ago

Alright, I thanks to the ability of any component to accept the color option getting around this manually isn't all that bad.

For what it's worth I think it would be nice if sparators were a little more flexible for cases that aren't necessarily intended to fill the line. On the other hand I'm sure trying to handle that sort of thing automatically is filled with annoying edge cases.

gennaro-tedesco commented 1 year ago

Alright, I thanks to the ability of any component to accept the color option getting around this manually isn't all that bad.

could you expand on how you got the separator to show and display the same custom colour you set? I am having the same issue (while creating an extension with custom themes) and seemingly the separators just disappear (I suppose the same problem you are describing).