Skip to content

fix: skip preview callback after source window closes - #789

Open
sean0407 wants to merge 1 commit into
stevearc:masterfrom
sean0407:codex/fix-preview-after-window-close
Open

sean0407 wants to merge 1 commit into
stevearc:masterfrom
sean0407:codex/fix-preview-after-window-close

Conversation

@sean0407

Copy link
Copy Markdown

Summary

open_preview callback
+ return when the source window/buffer or existing preview window is no longer valid
  resolve path and open the preview

Fixes #772. If the Oil window closes while get_edit_path() is still resolving, the delayed callback can use the closed window ID and raise Invalid window id. The guard also skips the callback if the source window has switched away from the captured Oil buffer. This is independent of #632 / #769, which addresses loading an already initialized preview buffer.

Evidence

  • Before: The focused regression failed after closing the source window, with Invalid window id: 1002.
  • After: The preview spec passed, 3/3 tests.
  • Full suite: 107 passed, 2 failed in move_rename_spec.lua; the same two failures occurred on the unmodified base commit d3733d9.

Merge Danger

Door: Two-way. The callback exits when its captured window state is gone.

Blast Radius: Low. The change is confined to preview callback handling and its regression test.

@github-actions
github-actions Bot requested a review from stevearc October 12, 2026 01:39
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.

bug: Insufficient nil check for cases where the buffer is closed before being loaded.

1 participant