fix(lsp): unwanted redraw for buffer not in window #40002

Problem:  Redrawing when a loaded buffer is not shown in any window on
          the current tabpage.
Solution: Check that buffer is shown in a (normal) window before redrawing.
This commit is contained in:
luukvbaal
2026-05-27 15:27:25 +02:00
committed by GitHub
parent c71e4ab2df
commit cad5a4cf5c
3 changed files with 18 additions and 2 deletions

View File

@@ -1143,7 +1143,7 @@ end
nvim_on('DiagnosticChanged', api.nvim_create_augroup('nvim.diagnostic.status', {}), {
desc = 'diagnostics component for the statusline',
}, function(ev)
if api.nvim_buf_is_loaded(ev.buf) then
if vim.fn.win_gettype(vim.fn.bufwinid(ev.buf)) == '' then
api.nvim__redraw({ buf = ev.buf, statusline = true })
end
end)