Skip to content

Guard pre-redisplay hook to prevent multi-frame feedback loop#371

Open
kovan wants to merge 1 commit into
alexluigit:mainfrom
kovan:fix/multi-frame-redisplay-loop
Open

Guard pre-redisplay hook to prevent multi-frame feedback loop#371
kovan wants to merge 1 commit into
alexluigit:mainfrom
kovan:fix/multi-frame-redisplay-loop

Conversation

@kovan

@kovan kovan commented Feb 13, 2026

Copy link
Copy Markdown

Summary

Context

dirvish-pre-redisplay-h is added to pre-redisplay-functions, which calls it for every window that needs redisplay. The function unconditionally calls dirvish--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 the dirvish--selected-window assignment since we already know window equals (frame-selected-window).

Fix: #353

🤖 Generated with Claude Code

`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>
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When opening multiple frames with dirvish preview window flickers

1 participant