fix(file_history): pin_local-safe Diff1/Diff1Inline for layout cycling#178
Conversation
There was a problem hiding this comment.
Pull request overview
Extends file-history pin_local safety to single-pane Diff1/Diff1Inline layouts by introducing pinned siblings (Diff1Pinned, Diff1InlinePinned) that declare shared_symbols = { "b" } and inherit the swap-aware detach semantics from the existing Diff2 pinned variants. The view's get_default_layout / resolve_pinned_layout / unpinned_layout now route Diff1 names through these pinned forms so cycle_layout and set_layout keep the cycle reachable without dropping the view-owned working-tree file. Fixes a regression where a Diff1 entry in cycle_layouts.default caused cycling to stall on the default Diff2 orientation under pin_local.
Changes:
- Add
Diff1PinnedandDiff1InlinePinnedclasses withshared_symbols = { "b" }anddetach_files_for_swapmirroringDiff2*Pinned. - Wire the new layouts into
config.layout_map/LayoutNameand intoFileHistoryView'spinned_variant/unpinned_varianttables, simplifying the pinned-vs-unpinned resolution paths. - Switch
Diff1Inline:owned_filesto defer toLayout:owned_files(so subclassshared_symbolsis honoured) and add unit/regression tests covering Diff1 pinned ownership, swap detach, cycling, and pinned-name fallbacks.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lua/diffview/scene/layouts/diff_1_pinned.lua | New pinned Diff1 layout with shared b-side and swap-aware detach. |
| lua/diffview/scene/layouts/diff_1_inline_pinned.lua | New pinned Diff1Inline layout; borrows detach_files_for_swap from Diff1Pinned. |
| lua/diffview/scene/layouts/diff_1_inline.lua | owned_files now delegates to Layout.owned_files so subclass shared_symbols is respected. |
| lua/diffview/scene/views/file_history/file_history_view.lua | Add Diff1 entries to pinned_variant; simplify get_default_layout / resolve_pinned_layout fallback logic; updated docstrings. |
| lua/diffview/config.lua | Register new pinned Diff1 names in LayoutName alias and layout_map; updated comment about pinned variants being internal. |
| lua/diffview/tests/functional/layouts_spec.lua | New tests for Diff1*Pinned owned_files and detach_files_for_swap behaviour. |
| lua/diffview/tests/functional/pin_local_spec.lua | Updated get_default_layout/resolve_pinned_layout/unpinned_layout tests for Diff1 pinned routing. |
| lua/diffview/tests/functional/cycle_layouts_spec.lua | New regression tests covering pin_local cycling with Diff1 entries and pin_local on/off symmetry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6e8d3d6 to
c4f9080
Compare
No description provided.