feat(view): add view.single_pane_for_one_sided option#191
Merged
Conversation
When enabled, files whose diff would be one-sided open in a single non-diff window via a new `Diff1Raw` layout instead of a `Diff2` with an empty pane (default `false`).
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in behavior to render one-sided diffs (added, untracked, deleted) as a single “normal file” window rather than a 2-pane diff with an empty side, addressing issue #184 by introducing an internal diff1_raw layout and a new view.single_pane_for_one_sided config flag.
Changes:
- Add
view.single_pane_for_one_sided(defaultfalse) and document it. - Introduce the
Diff1Rawlayout and select it automatically for one-sided entries when the option is enabled. - Fix
utils.set_local(..., method="remove")for comma-list options to avoid substring corruption, and add functional coverage for the new behaviors.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lua/diffview/utils.lua | Fix list-like option removal to operate on exact entries (no substring corruption). |
| lua/diffview/scene/window.lua | Scope view.foldlevel application to diff windows so non-diff layouts can preserve their own fold settings. |
| lua/diffview/scene/views/standard/standard_view.lua | Add diff1_raw winopts and ensure layout-key selection recognizes Diff1Raw. |
| lua/diffview/scene/layouts/diff_1_raw.lua | New single-window non-diff layout implementation (Diff1Raw). |
| lua/diffview/scene/file_entry.lua | Auto-select Diff1Raw for one-sided entries (when enabled) and handle deletion-side substitution semantics. |
| lua/diffview/config.lua | Register new config option and layout name mapping for internal resolution. |
| doc/diffview.txt | Document diff1_raw and view.single_pane_for_one_sided. |
| doc/diffview_defaults.txt | Add the new default config entry. |
| lua/diffview/tests/functional/window_spec.lua | Add regression test to ensure non-diff layouts preserve foldlevel. |
| lua/diffview/tests/functional/utils_spec.lua | Add coverage for list-like remove behavior on window-local winhighlight. |
| lua/diffview/tests/functional/single_pane_for_one_sided_spec.lua | New functional test suite for layout selection/substitution semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When enabled, files whose diff would be one-sided open in a single non-diff window via a new
Diff1Rawlayout instead of aDiff2with an empty pane (defaultfalse).Fixes #184.