Skip to content

feat(view): add view.single_pane_for_one_sided option#191

Merged
dlyongemallo merged 1 commit into
mainfrom
use_normal_buffer_for_new_files
May 20, 2026
Merged

feat(view): add view.single_pane_for_one_sided option#191
dlyongemallo merged 1 commit into
mainfrom
use_normal_buffer_for_new_files

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

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).

Fixes #184.

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`).
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

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 (default false) and document it.
  • Introduce the Diff1Raw layout 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.

@dlyongemallo dlyongemallo merged commit e94b7fd into main May 20, 2026
11 checks passed
@dlyongemallo dlyongemallo deleted the use_normal_buffer_for_new_files branch May 20, 2026 06:20
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.

When showing new files use normal (non diff buffer)

2 participants