Repository navigation
fix: clear snacks images in wezterm when they leave the screen - #43
Merged
Merged
Conversation
WezTerm has no Kitty unicode placeholders, so Snacks draws images at fixed screen positions that stay until the terminal gets an explicit delete. Snacks never sent it when an image buffer left its window, and fzf-lua swaps preview buffers with autocmds ignored, so previews were left behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In WezTerm, images rendered by snacks.nvim stayed on screen:
Root cause
WezTerm doesn't support Kitty unicode placeholders, so snacks draws images at fixed screen positions that persist until the terminal receives an explicit delete (
:redraw!does not clear them). Snacks never sent that delete because:placement:hide()only flags the image hidden.BufWipeoutcleanup andBufWinLeavehooks never fire.placement:update()returns early once the buffer is invalid (ready()is false), so it never reaches its own delete branch.Fix
lua/config/image.lua: wrap snacks' placementhide/del/updateto send the Kitty delete in fallback (no-placeholder) mode and close placements whose buffer is gone; track live placements so they can be re-checked.lua/plugins/image.lua: after fzf-lua'sset_preview_buf, re-check all placements.Testing
Reproduced in a separate WezTerm window driven via
nvim --serverwith screenshots at each step. Before: leftover images after preview changes, fzf close, and buffer switches. After: all clean; opening an image still shows it in its buffer and it reappears when switching back.🤖 Generated with Claude Code