Closed refLog2112 closed 4 months ago
Added some guards around the failing line and it seems to clear this up:
diff --git a/lua/lualine.lua b/lua/lualine.lua
index 6093049..e75f79e 100644
--- a/lua/lualine.lua
+++ b/lua/lualine.lua
@@ -426,8 +426,13 @@ local function refresh(opts)
and vim.fn.win_gettype(refresh_real_curwin) == 'popup'
and refresh_real_curwin
or win
- local stl_cur = vim.api.nvim_win_call(refresh_real_curwin, M.statusline)
+
+ local win_is_num = type(refresh_real_curwin) == "number"
+ local win_is_valid = win_is_num and vim.api.nvim_win_is_valid(refresh_real_curwin)
+
+ local stl_cur = win_is_valid and vim.api.nvim_win_call(refresh_real_curwin, M.statusline) or ""
local stl_last = modules.nvim_opts.get_cache('statusline', { window = set_win })
+
if stl_cur or stl_last then
modules.nvim_opts.set('statusline', stl_cur, { window = set_win })
end
There's probably a better fix that would answer why refresh_real_curwin
is ocassionally:
@liath Indeed this fix kind of works, but is hiding the status line. @folke is there something that can be related to Noice?
Regardless of how many splits are there, the Invalid window id: 1001
is always the error cause.
I reverted my change to see if I could find a better solution but can't seem to reproduce now. I pulled updates fwiw, maybe it'll help you @refLog2112
I dont see this issse. What are the exact steps to reproduce this using Noice and lualine?
@folke Here are the steps with a little demo
Still can't reproduce. Since both noice and lualine are part of LazyVim which is used by thousands of people, I would also be very surprised there's an interop issue there.
Feel free to open an issue in the noice repo with a minimal repro as instructed in the issue template.
The issue seems to be a job started with plenary. Closing this issue.
@refLog2112 Running into the same issue. Would you mind sharing what your fix was?
@AlexvZyl I see that you have also a plenary job that does the git compare and put it the lualine. Actually, I just disabled that section for now, and all was fine.
-- Run job to get git.
local result = Job:new({
command = 'git',
cwd = curr_dir,
args = { 'rev-list', '--left-right', '--count', 'HEAD...@{upstream}' },
})
:sync(100)[1]
{
U.get_git_compare,
separator = ' ',
padding = 0,
color = text_hl,
},
My guess is that plenary creates a window id which no longer exists after the job is done.
Self Checks
How to reproduce the problem
Expected behaviour
No error message is shown
Actual behaviour
Minimal config to reproduce the issue
globalstatus = true
Additional information
Everything works fine if a single buffer is in focus