Skip to content

fix(scene): prevent close event from bypassing floating panels#41

Merged
dlyongemallo merged 1 commit intomainfrom
fix_panel_close
Mar 15, 2026
Merged

fix(scene): prevent close event from bypassing floating panels#41
dlyongemallo merged 1 commit intomainfrom
fix_panel_close

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 15, 2026 10:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Diffview’s close-event handling so that when a floating panel is focused, the view itself doesn’t get closed inadvertently. It does this by changing listener initialization order and guarding the view close action when the active window is a float.

Changes:

  • Prevent the view-level close listener from closing the entire view when the current window is a floating window.
  • Initialize view event listeners earlier in post_open() so panel-level close handlers can take precedence.
  • Apply the same close-guard behavior in both DiffView and FileHistoryView listener sets.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
lua/diffview/scene/views/file_history/listeners.lua Guard view close when a floating window is focused.
lua/diffview/scene/views/file_history/file_history_view.lua Move init_event_listeners() earlier in post_open() for correct close-handler precedence.
lua/diffview/scene/views/diff/listeners.lua Guard view close when a floating window is focused.
lua/diffview/scene/views/diff/diff_view.lua Move init_event_listeners() earlier in post_open() for correct close-handler precedence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/diffview/scene/views/diff/listeners.lua
Comment thread lua/diffview/scene/views/file_history/listeners.lua
@dlyongemallo dlyongemallo merged commit 1e949f8 into main Mar 15, 2026
2 checks passed
@dlyongemallo dlyongemallo deleted the fix_panel_close branch March 15, 2026 13:31
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.

2 participants