Guard pre-redisplay hook to prevent multi-frame feedback loop#371
Open
kovan wants to merge 1 commit into
Open
Conversation
`dirvish-pre-redisplay-h` is called via `pre-redisplay-functions` for every window that needs redisplay, but it unconditionally calls `dirvish--redisplay`. When dirvish is open in multiple frames, this creates a feedback loop: frame A's redisplay triggers frame B's, and vice versa, causing visible flickering in the preview window. Guard the hook so it only fires for the selected window in its frame. Fix: alexluigit#353 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Merged
11 tasks
TreeSnowFence
added a commit
to TreeSnowFence/dirvish
that referenced
this pull request
May 31, 2026
Added a guard to redisplay hook to prevent multi-frame feedback loop. Without the guard, when dirvish is open in multiple frames, multiple calls to the redisplay function by different frames caused unpleasant stuttering. This fix prevents this by having the hook only fire in the selected window in it's frame. Credit to @kovan for the original pull request on dirvish main: alexluigit#371
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.
Summary
dirvish-pre-redisplay-hso it only fires for the selected window in its frameContext
dirvish-pre-redisplay-his added topre-redisplay-functions, which calls it for every window that needs redisplay. The function unconditionally callsdirvish--redisplay, which refreshes UI across all session windows in the selected frame. When dirvish is open in multiple frames, this creates a feedback loop: frame A's redisplay triggers frame B's redisplay, and vice versa, causing visible flickering.The fix wraps the function body in
(when (eq (frame-selected-window) window) ...)so it only runs when the window being redisplayed is actually the selected window in its frame. This also simplifies thedirvish--selected-windowassignment since we already knowwindowequals(frame-selected-window).Fix: #353
🤖 Generated with Claude Code