test(inline): cover BOF and adjacent-hunk fold ranges - #317
Conversation
Also minor fixes to comments.
There was a problem hiding this comment.
🟢 Approval recommended
The changes are test-only additions plus accurate doc/comment clarifications, and the new test assertions were verified to match the fold-range implementation.
Pull request overview
This PR strengthens the test suite for the inline diff fold logic in the diff1_inline layout, and makes small documentation/comment clarifications. It adds functional tests covering two previously untested edge cases in update_fold_ranges/foldexpr: a deletion at the very start of file (which anchors virtual lines above line 1) and adjacent hunks whose context ranges touch and get merged. The comment and doc tweaks clarify runtime behavior without changing any production logic.
Changes:
- Add a test verifying line 1 stays unfolded (and the deleted virt-line anchors above row 0) when the deletion is at BOF.
- Add a test verifying adjacent hunks' context ranges merge into a single fold range.
- Update
sanitize_cursor_map's doc comment to describe accepted entry shapes, and clarify indoc/diffview.txtthat a highfoldlevelmakesfold_unchangeda no-op.
File summaries
| File | Description |
|---|---|
lua/diffview/tests/functional/inline_diff_spec.lua |
Adds two expression folds tests covering BOF deletion and adjacent-hunk range merging; assertions match the implementation. |
lua/diffview/session.lua |
Rewords the sanitize_cursor_map doc comment to describe the accepted bare/wrapped entry shapes, consistent with the code. |
doc/diffview.txt |
Clarifies that setting foldlevel high enough to keep all folds open makes fold_unchanged a no-op; the foldlevel tag reference is valid. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Also minor fixes to comments.