Skip to content

Commit

Permalink
fix: bail early when checking for images to clear if there are no images
Browse files Browse the repository at this point in the history
  • Loading branch information
3rd committed Jun 29, 2023
1 parent bffa411 commit c891ad8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/image/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ api.setup = function(options)
vim.api.nvim_create_autocmd("BufWinEnter", {
group = group,
callback = function()
local has_images = false
for _ in pairs(state.images) do
has_images = true
break
end
if not has_images then return end

local windows = utils.window.get_visible_windows()
local win_buf_map = {}
for _, window in ipairs(windows) do
Expand Down

0 comments on commit c891ad8

Please sign in to comment.