MCPcopy Index your code
hub / github.com/modem-dev/hunk / findMaxLineNumber

Function findMaxLineNumber

src/ui/diff/codeColumns.ts:46–58  ·  view source on GitHub ↗
(file: DiffFile)

Source from the content-addressed store, hash-verified

44
45/** Find the widest line-number gutter needed for one file. */
46export function findMaxLineNumber(file: DiffFile) {
47 let highest = 0;
48
49 for (const hunk of file.metadata.hunks) {
50 highest = Math.max(
51 highest,
52 hunk.deletionStart + hunk.deletionCount,
53 hunk.additionStart + hunk.additionCount,
54 );
55 }
56
57 return Math.max(highest, 1);
58}
59
60/** Find the widest line-number gutter needed for an already-expanded row stream. */
61export function findMaxLineNumberInRows(rows: Iterable<DiffRow>, fallback = 1) {

Callers 4

AppFunction · 0.90
buildDiffSectionRowPlanFunction · 0.90
HunkDiffBodyFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected