Skip to content

fix(view): tighten cursor-carry around rename aliases and refreshes - #379

Open
dlyongemallo wants to merge 1 commit into
mainfrom
tighten_cursor_carry
Open

dlyongemallo wants to merge 1 commit into
mainfrom
tighten_cursor_carry

Conversation

@dlyongemallo

@dlyongemallo dlyongemallo commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner
  • restore_main_view now drops every cursor_map key pointing to the consumed state, not just path. A rename step installs that state under both path and its alias; dropping only one let the other replay a stale reveal on a later plain file switch.
  • snapshot_main_view drops any prior aliases at path before the overwrite, so a cancelled rename step can't leave reveal=true on an orphaned alias that the next step never names.
  • _is_revision_step short-circuits when the two entries share a commit hash. A panel refresh (R, FugitiveChanged) rebuilds every FileEntry, so the same-commit reopen was being mistaken for a step forward.
  • restore_file_history_entry reapplies reveal on every restored state so a resumed file-history browse still opens folds on the first open, matching live stepping. The sidecar schema stays bare.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The review has no active issues requiring resolution.

No open issues 🎉

What changed in this PR

This PR refines cursor carry in file-history views so rename aliases, panel refreshes, and restored sessions handle fold reveal consistently.

Changes:

  • Clear shared rename-alias cursor state when consumed or replaced.
  • Distinguish same-commit refreshes from revision steps, and enable fold reveal when restoring a file-history session.
  • Add regression tests and document the file-history fold-reveal opt-in.
File Description
lua/​diffview/​tests/​functional/​session_spec.lua Expect fold reveal in restored cursor state.
lua/​diffview/​tests/​functional/​cursor_carry_spec.lua Test alias cleanup and commit-aware revision-step detection.
lua/​diffview/​session.lua Enable fold reveal for restored file-history cursor entries.
lua/​diffview/​scene/​views/​standard/​standard_view.lua Clean up shared cursor aliases and exclude same-commit refreshes from revision steps.
lua/​diffview/​scene/​views/​file_history/​file_history_view.lua Document the existing revision-step fold-reveal opt-in.

Review effort: Balanced

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