Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tornikegomareli/gitdiff
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.9
Choose a base ref
...
head repository: tornikegomareli/gitdiff
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.1.0
Choose a head ref
  • 2 commits
  • 7 files changed
  • 2 contributors

Commits on May 13, 2026

  1. Add diffHunkHeaders and diffLineNumberStyle modifiers

    The library renders a side-by-side `old | new` gutter and an
    `@@ -a,b +c,d @@` separator above every hunk. Both are right for
    desktop unified-diff review and wrong for narrow viewports — on a
    phone every context line shows the same number twice (e.g. `19 19`,
    `20 20`) which reads as noise, and the hunk header eats screen space
    without adding signal beyond what the surrounding chrome (file name,
    stats badge) already conveys.
    
    This adds two opt-in knobs that leave today's behaviour unchanged:
    
    - `DiffConfiguration.LineNumberStyle = .hidden | .single | .dual`,
      default `.dual`. `.single` shows one column with the new line
      number for added/context and the old line number for removed —
      matching how `git diff --color` and most terminal renderers
      present a compact gutter.
    - `.diffLineNumberStyle(_:)` view modifier sets it explicitly. The
      legacy `.diffLineNumbers(_:Bool)` modifier and the legacy
      `showLineNumbers: Bool` init parameter still work: `true` → `.dual`,
      `false` → `.hidden`.
    - `showHunkHeaders: Bool`, default `true`, exposed via
      `.diffHunkHeaders(_:)`. Mirrors the existing
      `.diffFileHeaders(_:)` modifier.
    - New `.mobile` preset bundles `.single` + hidden hunk headers +
      compact font/spacing for a sensible mobile default.
    
    The existing modifiers (`.diffTheme`, `.diffFont`, `.diffLineSpacing`,
    `.diffWordWrap`) were each manually re-instantiating
    `DiffConfiguration` with the old field set — that would have silently
    reset the new fields whenever chained after `.diffLineNumberStyle` /
    `.diffHunkHeaders`. Switched them to the existing `.with*` builders
    so every field flows through unchanged.
    
    10 new tests cover field inference (legacy → new), the new
    modifiers, the `.mobile` preset, and that chaining other modifiers
    preserves the new fields. 21/21 passing total (was 11).
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
    tornikegomareli and claude committed May 13, 2026
    Configuration menu
    Copy the full SHA
    00c09df View commit details
    Browse the repository at this point in the history
  2. Merge pull request #10 from tornikegomareli/feat/hunk-header-and-line…

    …-number-style
    
    Add diffHunkHeaders + diffLineNumberStyle for mobile/minimal renderers
    tornikegomareli authored May 13, 2026
    Configuration menu
    Copy the full SHA
    114b571 View commit details
    Browse the repository at this point in the history
Loading