Skip to content

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

Open
kovan wants to merge 1 commit intoalexluigit: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 intoalexluigit:mainfrom
kovan:fix/multi-frame-redisplay-loop

Conversation

@kovan
Copy link
Copy Markdown

@kovan kovan commented Feb 13, 2026

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>
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