Unified-diff rendering and line accounting for anchored patches. Independent of the tool and activity namespaces.
Unified-diff rendering and line accounting for anchored patches. Independent of the tool and activity namespaces.
(head-tail-cap lines limit)(head-tail-cap lines limit what unit)Bound a line vector to limit, keeping a HEAD and a TAIL window rather than a
plain head-cut. A pure head-cut let a deletion-heavy preview fill the whole
visible budget with - lines and bury the + replacement below the cut, so a
correct edit read as a catastrophic deletion. what/unit name the truncation
in the caller's own words: a diff loses lines, a patch report loses rows.
Bound a line vector to `limit`, keeping a HEAD and a TAIL window rather than a plain head-cut. A pure head-cut let a deletion-heavy preview fill the whole visible budget with `-` lines and bury the `+` replacement below the cut, so a correct edit read as a catastrophic deletion. `what`/`unit` name the truncation in the caller's own words: a diff loses lines, a patch report loses rows.
(line-change-counts before after){"added" a "removed" r "modified" m} for one file's before→after, or nil
when nothing changed. The :diff is capped hunk-wise for rendering, so these
counts are computed from the content itself and stay exact for the whole file
even when the rendered diff is truncated. A new file is all additions, a
deleted one all removals.
`{"added" a "removed" r "modified" m}` for one file's before→after, or nil
when nothing changed. The `:diff` is capped hunk-wise for rendering, so these
counts are computed from the content itself and stay exact for the whole file
even when the rendered diff is truncated. A new file is all additions, a
deleted one all removals.(unified-diff-text before after)Unified diff preview for two file blobs: real @@ hunks at real file line
numbers, bounded hunk-wise. Only a change too expensive to diff (a full
rewrite of a very large file) drops to the linear bounded preview.
A WHOLE-FILE REWRITE (a Python whole-file write —
nothing of the old content survives) renders ONE side only: the new content
as + lines under a --- (replaced, N line(s)) marker. Both sides there
printed the file twice on every renderer (TUI and companion app read this
same "diff" string), so the fix belongs here, not in the renderers.
Unified diff preview for two file blobs: real `@@` hunks at real file line numbers, bounded hunk-wise. Only a change too expensive to diff (a full rewrite of a very large file) drops to the linear bounded preview. A WHOLE-FILE REWRITE (a Python whole-file write — nothing of the old content survives) renders ONE side only: the new content as `+` lines under a `--- (replaced, N line(s))` marker. Both sides there printed the file twice on every renderer (TUI and companion app read this same `"diff"` string), so the fix belongs here, not in the renderers.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |