Thanks to visit codestin.com
Credit goes to github.com

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: dlvhdr/diffnav
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: matart/diffnav
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 4 commits
  • 13 files changed
  • 3 contributors

Commits on May 26, 2026

  1. fix: show line numbers for new and deleted files (#1)

    When side-by-side mode is requested, diffnav skips it for new/deleted
    files because one side has no content. The fallback to unified mode
    dropped delta's line-number gutter, so the file body appeared without
    line numbers. Pass --line-numbers in that fallback so they stay visible.
    
    Co-authored-by: Claude <[email protected]>
    matart and Claude authored May 26, 2026
    Configuration menu
    Copy the full SHA
    3d2dffa View commit details
    Browse the repository at this point in the history

Commits on May 27, 2026

  1. fix: highlight PHP diffs when hunks don't include the opening tag (#2)

    Delta delegates highlighting to syntect, whose PHP grammar starts in HTML
    mode and only enters PHP scope after seeing <?php / <?=. Diff hunks that
    don't include the opening tag therefore render with no keyword colouring.
    Delta also restarts syntect per hunk, so even files with <?php near the
    top still lose highlighting for any later hunks.
    
    Pre-process each PHP file's diff before piping to delta: for every hunk
    that doesn't already contain <?php / <?=, shift the hunk start down by 1
    and inject `<?php /*diffnav_phpfix*/` as a synthetic context line. After
    delta runs, drop every output line whose ANSI-stripped text contains the
    sentinel marker so the injection is invisible. Real content keeps its
    original line numbers; hunks starting at line 1 are skipped (can't shift).
    
    Co-authored-by: Claude <[email protected]>
    matart and Claude authored May 27, 2026
    Configuration menu
    Copy the full SHA
    b30203b View commit details
    Browse the repository at this point in the history

Commits on May 28, 2026

  1. docs: add IDEAS.md roadmap and localize README to this fork

    IDEAS.md captures the plan to evolve diffnav into a stateful AI-era code
    review workspace: storage config, the 7 ranked features (reviewed
    markers, smart ordering, hunk explain/critique, pre-push Claude review,
    GH PR comments inline, local line comments, AI hunk threads), and the
    suggested build order.
    
    README is trimmed to reflect that this is a personal fork: install from
    source instead of upstream's Homebrew tap, drop the sponsorship and
    Discord sections (those belong to upstream), and add a Credits section
    linking back to dlvhdr/diffnav.
    
    Co-Authored-By: Claude <[email protected]>
    matart and Claude committed May 28, 2026
    Configuration menu
    Copy the full SHA
    b75f777 View commit details
    Browse the repository at this point in the history
  2. feat: per-hunk reviewed markers persisted across sessions (#3)

    * feat: per-hunk reviewed markers persisted across sessions
    
    Toggle a hunk with `r` to mark it reviewed. State persists to a JSON
    file (default ~/.local/share/diffnav/reviewed.json), keyed by repo root
    and hunk content hash, so renaming a file or editing a hunk invalidates
    the marker — and unrelated changes elsewhere in the file don't.
    
    Visuals:
    - Diff viewer: green `✓ reviewed` line above each reviewed hunk header.
      Hunk header pattern (─┐ box) is identical in unified and side-by-side
      modes, so detection works in both.
    - File tree: `n/m` badge after the diff stats; row dims to grey once
      every hunk in the file is reviewed.
    
    Architecture:
    - New `pkg/reviewed` package owns the storage abstraction (HunkID,
      State.Toggle/IsReviewed/CountReviewed/Save, ResolvePath with env
      override). Atomic write on Save (tmpfile + rename). JSON for v1 — a
      single file per machine, keyed by repo root.
    - `storage.path` config option; `DIFFNAV_STORAGE_DIR` env override;
      XDG_DATA_HOME default.
    - Diffviewer caches both the raw delta output and the marker-applied
      render. `SetReviewedMask` re-applies markers without re-running delta.
      `CurrentHunkIndex` maps viewport YOffset → fragment index (topmost-
      passed hunk = current).
    - Filetree FileNode takes a `ReviewedFn` callback that closes over the
      mainModel's state, so the badge stays fresh without tree rebuilds.
    
    Tests:
    - pkg/reviewed: HunkID stability, repo isolation, atomic save round-trip,
      env/yaml/tilde/XDG path resolution
    - pkg/ui/panes/diffviewer: hunk-header detection, marker injection +
      offset recomputation
    
    This is the first stateful feature in diffnav and establishes the
    storage layer outlined in IDEAS.md #1.
    
    Co-Authored-By: Claude <[email protected]>
    
    * feat: make reviewed-hunks UX discoverable
    
    Adds the missing affordances around the `r` keybinding so users can
    actually find and use it.
    
    - Inline highlight: the current hunk's top-border is restyled in bright
      cyan with a ▸ prefix so you can see which hunk r will toggle. Updates
      as you scroll.
    - Hunk navigation: `]` jumps to the next hunk, `[` to the previous —
      scrolls the viewport so the target hunk's header sits at the top.
    - Header indicator: the diff viewer header now shows
      `hunk 3/7 ✓ reviewed   r toggle · ] [ next/prev` so the user always
      knows which hunk is current, its state, and the keybindings.
    - File tree badge: now always rendered when a file has hunks (dim `0/n`
      for not-started, green `n/n` for complete). Was previously hidden
      until at least one hunk was reviewed, which made the marker invisible
      before you knew about `r`.
    
    Architecture:
    - `applyReviewedMarkers` now takes a currentIdx and restyles that hunk's
      top-border line. ANSI is stripped + re-rendered so line count stays
      the same — no scroll jumps.
    - Diffviewer detects viewport YOffset changes in Update and re-renders
      when the current hunk changes. Refresh is centralized in
      `refreshView`.
    - `NextHunk`/`PrevHunk` use the cached hunkOffsets to move the viewport;
      the YOffset change triggers the auto re-render.
    
    Co-Authored-By: Claude <[email protected]>
    
    * fix: refresh file tree badge after toggling a hunk reviewed
    
    Two bugs were keeping the tree badge stale:
    
    1. tree.Model caches its rendered viewport content. Toggling a hunk
       mutates State but never reaches the tree's render pipeline, so the
       badge keeps showing the value it had when the viewport was last
       populated.
    2. The lookup closure passed into the file tree captures a snapshot of
       mainModel. If repoRootMsg arrives after fileTreeMsg, the closure's
       frozen repoRoot is empty while toggle uses the live (correct) value,
       so writes and reads disagree on the storage key.
    
    Fix:
    - New filetree.Model.Refresh() calls SetNodes(t.Root()) — re-runs
      viewport population using the existing tree, so folder open/closed
      state and cursor position are preserved.
    - toggleReviewedAtCursor calls Refresh after mutating state, so the new
      badge count appears immediately.
    - repoRootMsg handler re-binds the lookup via SetReviewedLookup so the
      closure captures the current m (now with repoRoot set). This rebuild
      only happens once at startup, before any user navigation.
    
    Co-Authored-By: Claude <[email protected]>
    
    * fix: stop the file tree from accumulating folder icons on toggle
    
    bubbles/tree.SetNodes called with the same root keeps prepending the
    open-folder indicator to the root's tree.value via setRootStyles: each
    SetNodes reads m.root.value (already prefixed), strips ANSI, and
    re-prefixes with Indicator(). Result: one extra folder icon at the top
    of the file tree on every Refresh.
    
    Refresh now rebuilds the tree from scratch (which sets the root cleanly
    from DirNode.String()) and restores the bits a rebuild would otherwise
    clobber:
    - snapshot which DirNode FullPaths are currently closed, re-close them
      on the new tree
    - snapshot the cursor path, restore via SetYOffset on the matching node
      in the new tree
    
    Co-Authored-By: Claude <[email protected]>
    
    * fix: allow marking trailing hunks the viewport can't scroll past
    
    CurrentHunkIndex used to derive the active hunk from vp.YOffset(), but
    the viewport clamps YOffset to totalLines-height. For files where the
    last hunks' headers sit inside the viewport's height at maximum scroll,
    YOffset never advanced past them — so they could never be marked
    reviewed.
    
    Make currentHunkIdx the source of truth:
    - ] / [ increment / decrement currentHunkIdx directly, then scroll the
      viewport to the chosen hunk (clamped is fine — the header is still on
      screen). lastYOffset is synced so the scroll handler doesn't override.
    - j / k / Ctrl-D / Ctrl-U still re-derive via the existing
      largest-passed-hunk heuristic.
    - CurrentHunkIndex returns the state field, clamped to bounds.
    
    Co-Authored-By: Claude <[email protected]>
    
    * feat: highlight the full title line of the current hunk
    
    Previously only the top border (─┐) of the current hunk's header got
    restyled in cyan, leaving the title line (line number + function context)
    in delta's default dim grey. The visual distinction was easy to miss.
    
    Now all three lines of the header box — top border, title, bottom border
    — get restyled in bright cyan bold when the hunk is current. The title
    itself stands out, so it's obvious which hunk r will toggle.
    
    * fix: title alignment + show reviewed marker below the hunk box
    
    1. The current-hunk title restyle was adding a leading space on top of
       delta's already-padded line, pushing the `│` one column past the
       `┐`/`┘`. Preserve delta's exact spacing when re-rendering.
    2. The "✓ reviewed" line was inserted above the top border, which
       disappeared off-screen when the hunk was at the top of the viewport.
       Move it below the bottom border so it stays visible with the box.
    
    * feat: ] / [ wrap to next / previous file across hunk boundaries
    
    Pressing ] on the last hunk of a file now jumps to the first hunk of the
    next file. Pressing [ on the first hunk jumps to the last hunk of the
    previous file. Keep tapping ] to walk every hunk across the whole diff.
    
    Implementation:
    - New diffviewer.SetCurrentHunkIndex(idx) — applies immediately if the
      diff is rendered, otherwise stores as pending. moveToFile triggers an
      async diff fetch, so the pending path handles the case where we set
      the hunk index before diffContentMsg arrives.
    - The diffContentMsg handler picks up any pending index, applies it
      before applyReviewedMarkers (so the cyan highlight lands on the right
      hunk), and scrolls to it after the viewport content is set.
    - pendingHunkIdx is cleared on each SetFilePatch so a stale pending from
      a previous transition can't leak.
    
    * feat: color the current hunk title by review state
    
    Orange when the active hunk is unreviewed, green once it's marked.
    Reinforces the same green/grey signal you get from the file tree badge
    and the ✓ reviewed marker — at a glance you can tell whether the hunk
    you're on still needs your attention or is already done.
    
    ---------
    
    Co-authored-by: Claude <[email protected]>
    matart and Claude authored May 28, 2026
    Configuration menu
    Copy the full SHA
    b399ae3 View commit details
    Browse the repository at this point in the history
Loading