fix(#2954): resolve occasional tree flashing on diagnostics, set tree buffer options in deterministic order (#2980)

* fix(#2954): set buffer options in deterministic order

This ensures related autocmd's (e.g. on FileType) will be called in a
similar environment.

* fix(#2954): redraw only for diagnostics if source buffer is 'buflisted'

is_buf_valid has been inlined since it is only used for diagnostics
and its name is misleading.
This commit is contained in:
des-b
2024-11-02 02:07:42 +01:00
committed by GitHub
parent 120ba58254
commit 82ab19ebf7
2 changed files with 18 additions and 15 deletions

View File

@@ -165,7 +165,13 @@ function M.update()
end
end
log.profile_end(profile)
if view.is_buf_valid(view.get_bufnr()) then
local bufnr = view.get_bufnr()
local should_draw = bufnr
and vim.api.nvim_buf_is_valid(bufnr)
and vim.api.nvim_buf_is_loaded(bufnr)
and vim.api.nvim_get_option_value("buflisted", { buf = bufnr })
if should_draw then
local explorer = core.get_explorer()
if explorer then
explorer.renderer:draw()