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:
parent
31f648f8ce
commit
9ef1a0f324
@ -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()
|
||||
|
||||
@ -500,12 +500,6 @@ function M.get_bufnr()
|
||||
return BUFNR_PER_TAB[vim.api.nvim_get_current_tabpage()]
|
||||
end
|
||||
|
||||
---@param bufnr number
|
||||
---@return boolean
|
||||
function M.is_buf_valid(bufnr)
|
||||
return bufnr and vim.api.nvim_buf_is_valid(bufnr) and vim.api.nvim_buf_is_loaded(bufnr)
|
||||
end
|
||||
|
||||
function M._prevent_buffer_override()
|
||||
local view_winnr = M.get_winnr()
|
||||
local view_bufnr = M.get_bufnr()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user