Skip to content

fix: make diffopt save/restore state per-view#102

Merged
dlyongemallo merged 1 commit intomainfrom
diffopt_per_view
Apr 13, 2026
Merged

fix: make diffopt save/restore state per-view#102
dlyongemallo merged 1 commit intomainfrom
diffopt_per_view

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 13, 2026 05:43
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

Fixes diffopt save/restore behavior so it’s tracked per View instance (instead of a single module-level saved value), preventing multiple open views from clobbering each other’s original diffopt state.

Changes:

  • Store the pre-override diffopt on each View (view._saved_diffopt) and restore from that per-view value.
  • Add a functional regression spec that simulates multiple views applying/restoring diffopt independently.
  • Export internal apply/restore helpers from diffview.scene.view to support the regression spec.

Reviewed changes

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

File Description
lua/diffview/scene/view.lua Moves saved diffopt state from a module-global to a per-view field; wires apply/restore to use self.
lua/diffview/tests/functional/view_spec.lua Adds regression coverage for independent per-view diffopt saved state.

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

Comment thread lua/diffview/tests/functional/view_spec.lua
Comment thread lua/diffview/scene/view.lua Outdated
The saved `diffopt` value was stored in a module-level variable, which
could cause one view's close to clobber another view's saved state when
multiple `Diffview` tabs are open. Move the saved value onto the view
instance (`self._saved_diffopt`) so each view tracks its own snapshot.
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

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


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

@dlyongemallo dlyongemallo merged commit 67d9798 into main Apr 13, 2026
6 checks passed
@dlyongemallo dlyongemallo deleted the diffopt_per_view branch April 13, 2026 06:19
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