Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Flicker Issue on Lualine Still Exist #1280

Open
1 of 2 tasks
ochi12 opened this issue Jul 24, 2024 · 19 comments
Open
1 of 2 tasks

Bug: Flicker Issue on Lualine Still Exist #1280

ochi12 opened this issue Jul 24, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@ochi12
Copy link

ochi12 commented Jul 24, 2024

Self Checks

  • I'm using the latest lualine.
  • I didn't find the issue in existing issues or PRs.

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 ochi12 added the bug Something isn't working label Jul 24, 2024
@ochi12
Copy link
Author

ochi12 commented Jul 24, 2024

Screencast.from.2024-07-24.22-59-19.mp4

@bighi
Copy link

bighi commented Jul 25, 2024

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
Copy link

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.

@maleksware
Copy link

maleksware commented Oct 8, 2024

This seems to be happening only with globalstatus = true. The cause of the flicker seems to also be the cause of the highlight group corruption bug in NvimTree (untested with other trees) (nvim-tree/nvim-tree.lua#245)

Edit: the highlight corruption has been fixed there, small compatibility issue (1c9553a19f70df3dcb171546a3d5e034531ef093).

@shadmansaleh
Copy link
Member

Can you check if #1316 fixes the flickering?

@maleksware
Copy link

Doesn't seem so. The flicker is now longer (I'd assume it to be 100ms as specified in the PR).

@shadmansaleh
Copy link
Member

Doesn't seem so. The flicker is now longer (I'd assume it to be 100ms as specified in the PR).

Give it another go if you have time. I've added another fix.

@maleksware
Copy link

This has fixed it indeed. Thanks a lot! I'd also wait for the OP's replication but it worked no problem for me (in the circumstances similar to the original issue).

@sand4rt
Copy link

sand4rt commented Nov 1, 2024

Thank you for looking into this! The flicker still exists for me unfortunately, but seems to be less, also got errors when i open telescope sometimes;

 E5108: Error executing lua ../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:429: Invalid window id: 1003 
 stack traceback: 
 [C]: in function 'nvim_win_call'  .../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua 
 a:429: in function <.../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:318> 

Related; #1220

@shadmansaleh
Copy link
Member

@sand4rt see if your issue is fixed now in #1316

@sand4rt
Copy link

sand4rt commented Nov 1, 2024

@sand4rt see if your issue is fixed now in #1316

@shadmansaleh thank you! the error is gone, the flicker still exists for me unfortunately.

@shadmansaleh
Copy link
Member

@sand4rt try the latest commit on that pr. If the flicker still exists do provide a minimal config and instructions to reproduce it.

@sand4rt
Copy link

sand4rt commented Nov 1, 2024

@shadmansaleh Big improvement! Although, there's still some flickering most of the time (especially when toggling Telescope + editing a large file). Please let me know if this is sufficient; otherwise, i’ll start disabling plugins one by one and send the minimal config

@shadmansaleh
Copy link
Member

I don't see flickering on either cases.
Are you sure you aren't doing something in your config that might delay the first render? Try to create an isolated minimal config with https://github.com/nvim-lualine/lualine.nvim/blob/640260d7c2d98779cab89b1e7088ab14ea354a02/scripts/nvim_isolated_conf.sh

A short screen recording would be a good addition too

@sand4rt
Copy link

sand4rt commented Nov 2, 2024

Hey @shadmansaleh, it was hard to pinpoint the flicker to a specific plugin, but i've found a consistent way to reproduce it:

recording_2024-11-02_15.02.34.mp4
  1. Start Neovim
  2. Open Telescope using Space + Space

The flicker only happens once at this point, and nvim-cmp seems to be related;

https://github.com/sand4rt/lualine-flicker

Do you want me to send a larger config where the flicker happens more often?

@shadmansaleh
Copy link
Member

Can you try to drop as much as stuff from your lualine config while the bug still occurs ? I mean just the lualine config you gave me is 400 lines

Do you want me to send a larger config where the flicker happens more often?

Quite the opposite. I want a config as little config and as few plugins as possible. I don't have the time nor the energy to go through thousands of lines of config that pulls several times more as plugins.

@sand4rt
Copy link

sand4rt commented Nov 3, 2024

@shadmansaleh I've removed additional unrelated code. Hopefully, this streamlines things—but let me know if i can do anything else. It's basically a clean install of telescope+lualine+cmp. You might have to spam space + space and esc to close telescope a few times to see the flicker

@ochi12
Copy link
Author

ochi12 commented Nov 3, 2024

I think this is a status line issue tho. I haven't tried using my config yet without the Lualine installed

@shadmansaleh
Copy link
Member

@sand4rt unfortunately, I couldn't reproduce the flickering you mentioned with your config. Only case I could find flickering in that branch is with cmdheight=0 without showmode=false. That makes sense and showmode and statusline is fighting for the same space. The builtin statusline behaves the same in this case.

I'll merge that pr and mark this as resolved for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants