[stacked] Add single side-aware rail rendering #156

Closed
opened 2026-09-21 18:12:36 +00:00 by barrettruth · 0 comments
Owner

Original issue: barrettruth/diffs.nvim#362
Original author: barrettruth
Original date: 2026-05-28T02:57:34Z

Part of #358.

Goal

Add an internal single side-aware generated rail style while preserving current dual old/new rails by default.

Scope

  • Extend rails.annotate() with an internal rail_style = 'dual'|'single' option.
  • Keep dual as the default and preserve existing output exactly.
  • Implement single rail line-number semantics:
    • deleted lines show old-side line numbers;
    • added lines show new-side line numbers;
    • context lines show new-side line numbers;
    • file headers, hunk headers, and metadata rows show no file line number.
  • Return rail metadata that identifies the rendered style, for example RailInfo.style.
  • Add style-aware rail number range helpers for highlighting rather than forcing the current dual-only range shape to represent single rails.
  • Keep custom view.rail_separator behavior, including empty string support.
  • Preserve empty context line stripping behavior.

Non-goals

  • Do not wire ++layout=stacked into commands yet.
  • Do not add public config.
  • Do not change split endpoint windows.

Acceptance criteria

  • Default generated buffers keep the existing dual rail behavior.
  • rails.annotate(lines, { rail_style = 'single' }) produces a narrower single side-aware rail.
  • Single rail metadata reports the correct prefix and separator widths.
  • rails.strip() and rails.strip_lines() recover raw unified diff text from single-rail display lines.
  • Custom rail separators work with single rails.
> Original issue: barrettruth/diffs.nvim#362 > Original author: `barrettruth` > Original date: 2026-05-28T02:57:34Z Part of #358. ## Goal Add an internal single side-aware generated rail style while preserving current dual old/new rails by default. ## Scope - Extend `rails.annotate()` with an internal `rail_style = 'dual'|'single'` option. - Keep `dual` as the default and preserve existing output exactly. - Implement single rail line-number semantics: - deleted lines show old-side line numbers; - added lines show new-side line numbers; - context lines show new-side line numbers; - file headers, hunk headers, and metadata rows show no file line number. - Return rail metadata that identifies the rendered style, for example `RailInfo.style`. - Add style-aware rail number range helpers for highlighting rather than forcing the current dual-only range shape to represent single rails. - Keep custom `view.rail_separator` behavior, including empty string support. - Preserve empty context line stripping behavior. ## Non-goals - Do not wire `++layout=stacked` into commands yet. - Do not add public config. - Do not change split endpoint windows. ## Acceptance criteria - Default generated buffers keep the existing dual rail behavior. - `rails.annotate(lines, { rail_style = 'single' })` produces a narrower single side-aware rail. - Single rail metadata reports the correct prefix and separator widths. - `rails.strip()` and `rails.strip_lines()` recover raw unified diff text from single-rail display lines. - Custom rail separators work with single rails.
barrettruth 2026-09-21 18:12:36 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
barrettruth/diffs.nvim#156
No description provided.