nvim-lualine / lualine.nvim

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

Bug: Flicker Issue on Lualine Still Exist #1280

Open ochi12 opened 1 month ago

ochi12 commented 1 month ago

Self Checks

Expected behaviour

This was Already Solved In issue #744 I already looked up the source code in and confirmed it was already commited d2a727.

Actual behavior

The flicker issue is still bugging me Specifically when toggling NeoTree. Also when opening Telescope just like in [ issue #1220 ] It also do flicker

Minimal config to reproduce the issue

local lualine_c = function()

    local devicons = require("nvim-web-devicons")
    local theme = require("lualine.themes.catppuccin")
    local mocha = require("catppuccin.palettes").get_palette("mocha")

    -- overriding default colors
    theme.normal.c.bg = "#242435"

    -- defining section colors
    local z_colors = {
        left = {
            bg = theme.insert.a.bg,
            fg = theme.insert.a.fg,
        },
        right = {
            bg = theme.normal.b.bg,
            fg = theme.insert.b.fg,
        },
    }

    local y_colors = {
        left = {
            bg = mocha.red,
            fg = mocha.base,
        },
    }

    require("lualine").setup({
        options = {
            theme = theme,

            ignore_focus = { "neo-tree"  },
            disabled_filetypes = { statusline = { "neo-tree" }  },
            section_separators = { left = "", right = "" },
            component_separators = { left = "", right = "" },
            globalstatus = true,

            refresh = {
                statusline = 100,
            }
        },

        sections = {
            lualine_a = {
                {
                    "mode",
                    separator = { right = "" },
                    fmt = function(str)
                        return " " .. str
                    end,
                },
            },
            lualine_b = {
                {
                    function()
                        return ""
                    end,
                    padding = 0,
                    color = { bg = mocha.surface1 },
                    separator = { right = "" },
                },
                {
                    "filename",
                    padding = { left = 2, right = 2 },
                    colored = false,
                    fmt = function(str)
                        local name = str
                        local extension = vim.fn.fnamemodify(name, ":e")
                        local icon = devicons.get_icon(name, extension, { default = true })
                        return icon .. " " .. str
                    end,
                    symbols = {
                        unnamed = "unnamed",
                        newfile = "new file",
                        modified = MyIco.file.modified,
                        readonly = MyIco.file.readonly,
                    },
                    separator = { right = "" },
                    color = { fg = mocha.text },
                },
            },
            lualine_c = {
                {
                    "branch",
                    color = { fg = mocha.surface1 },
                    icon = "",
                },
                {
                    "diff",
                    colored = false, -- Displays a colored diff status if set to true
                    symbols = {
                        added = MyIco.file.added,
                        modified = MyIco.file.modified,
                        removed = MyIco.file.removed,
                    }, -- Changes the symbols used by the diff.
                    source = nil,
                    color = { fg = mocha.surface1 },
                },
            },
            lualine_x = {
                {
                    "diagnostics",
                    symbols = {
                        warn = MyIco.diagnostics.warn .. " ",
                        error = MyIco.diagnostics.error .. " ",
                        hint = MyIco.diagnostics.hint .. " ",
                        info = MyIco.diagnostics.info .. " ",
                    }
                },
                {
                    function(str)
                        local current_lsp = vim.lsp.get_active_clients()[1]["_log_prefix"]
                        return "LSP ~ " .. current_lsp:sub(5, -2)
                    end,
                    icons_enabled = true,
                    icon = " ",
                    color = { fg = mocha.blue },
                },
            },
            lualine_y = {
                {
                    function()
                        return " "
                    end,
                    separator = { left = "" },
                    padding = { left = 0, right = 1 },
                    color = y_colors.left,
                },

                {
                    function()
                        local cwd = vim.fn.getcwd()
                        local home = vim.fn.expand("~")
                        cwd = cwd:gsub(home, "~")

                        --local cwd_list = vim.split(cwdp, "/")

                        --cwd = table.concat(vim.list_slice(cwd_list, 1, 3), "/")

                        return cwd
                    end,
                    color = { fg = mocha.text },
                },
            },
            lualine_z = {
                {
                    function()
                        return "󰦪"
                    end,
                    separator = { left = "" },
                    padding = { left = 0, right = 1 },
                    color = z_colors.left,
                },
                {
                    "progress",
                    color = z_colors.right,
                },
            },
        },
    })
end

return lualine_c

Additional information

ochi12 commented 1 month ago

https://github.com/user-attachments/assets/ee5d5a0d-4bf0-4a33-aa0d-f704e92761e7

bighi commented 1 month ago

Also flickering for me. I tried 4 different themes, and they all had the issue, so it's not associated with a particular theme.

I'm using the latest iTerm app, on an M3 Max MacBook Pro.

MarceliJankowski commented 3 weeks ago

I'm running into the same issue when toggling Netrw. Lualine also flickers when I open new buffers from within Netrw. These flickerings do not happen every time; more like every 3-4 time.