Skip to content

fix: validate diff layout, fall back to tab on unknown value#86

Merged
Cannon07 merged 1 commit into
mainfrom
fix/validate-diff-layout
Jun 11, 2026
Merged

fix: validate diff layout, fall back to tab on unknown value#86
Cannon07 merged 1 commit into
mainfrom
fix/validate-diff-layout

Conversation

@Cannon07

Copy link
Copy Markdown
Owner

Summary

Validates the resolved diff layout and falls back to tab on an unknown value, instead of silently rendering as a tab with no feedback.

An unknown layout — a typo ("vspllit") or a layout removed in a future version — previously fell through to the tabnew branch silently, so a misconfigured diff.layout / diff.layouts looked ignored. Pre-existing gap surfaced during the #82 review (the per-backend layouts map widened the surface).

Changes

  • diff.luavalid_layout() check inside the layout_for_backend resolution chokepoint, covering both diff.layout and the per-backend diff.layouts overrides in one place. Warns once per bad value (via a warned_layouts guard) and falls back to "tab" — the once-guard matters because log.warn fires a user-visible vim.notify, which would otherwise pop on every diff.
  • tests/ — two specs: unknown default layout → tab, unknown per-backend override → tab.

Testing

  • Full Lua suite green on macOS (178 passed). New tests cover both validation branches.
  • Pure Lua / OS-independent; no path or PowerShell handling involved.

🤖 Generated with Claude Code

An unknown diff layout — a typo like "vspllit", or a layout removed in a
future version — silently fell through to the "tabnew" branch, making the
config look ignored. Validate the resolved layout (both diff.layout and the
per-backend diff.layouts overrides) in the layout_for_backend chokepoint;
warn once (log.warn surfaces via vim.notify, so guard against per-diff
spam) and fall back to "tab".

Surfaced during review of #82 (per-backend layouts) as a pre-existing gap
that the new layouts map widened.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Cannon07 Cannon07 merged commit 15cb8da into main Jun 11, 2026
3 checks passed
@Cannon07 Cannon07 deleted the fix/validate-diff-layout branch June 11, 2026 19:26
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.

1 participant