Skip to content

Commit

Permalink
fix(buflist): check if buffer is valid outside of cache. buf_func doe…
Browse files Browse the repository at this point in the history
…s not need to check if buf is valid.
  • Loading branch information
rebelot committed Jan 10, 2023
1 parent b27f8e2 commit 8a98c7d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/heirline/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ end

local function get_bufs()
return tbl_filter(function(bufnr)
return nvim_buf_get_option(bufnr, "buflisted") and nvim_buf_is_valid(bufnr)
return nvim_buf_get_option(bufnr, "buflisted")
end, nvim_list_bufs())
end

Expand Down Expand Up @@ -284,7 +284,9 @@ function M.make_buflist(buffer_component, left_trunc, right_trunc, buf_func, buf
end

self.active_child = false
local bufs = buf_func()
local bufs = tbl_filter(function(bufnr)
return nvim_buf_is_valid(bufnr)
end, buf_func())
local visible_buffers = bufs_in_tab()

for i, bufnr in ipairs(bufs) do
Expand Down

0 comments on commit 8a98c7d

Please sign in to comment.