Skip to content

fix(image): reset hidden state when buffer becomes visible again#2793

Open
shy-robin wants to merge 1 commit intofolke:mainfrom
shy-robin:fix/image-hidden-not-reset-on-reenter
Open

fix(image): reset hidden state when buffer becomes visible again#2793
shy-robin wants to merge 1 commit intofolke:mainfrom
shy-robin:fix/image-hidden-not-reset-on-reenter

Conversation

@shy-robin
Copy link
Copy Markdown

Summary

When switching away from an image buffer, placement:update() calls hide() which sets self.hidden = true. When switching back, update() is triggered via BufEnter/BufWinEnter autocmds, but self.hidden is never reset to false. This causes _render() to produce empty extmarks, leaving the image invisible (stuck showing "identify loading…" or blank).

Steps to reproduce:

  1. Open an image file via nvim-tree or fzf-lua — image displays correctly
  2. Switch to another (non-image) buffer
  3. Switch back to the image buffer — image fails to render

Fix: Reset self.hidden = false when update() detects visible windows (#state.wins > 0), so the image re-renders correctly on buffer re-entry.

Test plan

  • Open image → switch away → switch back: image re-renders correctly
  • Multiple image buffers: switching between them works as expected
  • No regression: images still hide properly when no window is displaying them

When switching away from an image buffer, `update()` calls `hide()` which
sets `self.hidden = true`. When switching back, `update()` is triggered
via BufEnter/BufWinEnter autocmds, but `self.hidden` is never reset to
`false`. This causes `_render()` to produce empty extmarks, leaving the
image invisible.

Reset `self.hidden = false` when `update()` detects visible windows
(`#state.wins > 0`), so the image re-renders correctly on buffer re-entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added image size/s Small PR (<10 lines changed) labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

image size/s Small PR (<10 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant