(file: DiffFile)
| 44 | |
| 45 | /** Find the widest line-number gutter needed for one file. */ |
| 46 | export 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. */ |
| 61 | export function findMaxLineNumberInRows(rows: Iterable<DiffRow>, fallback = 1) { |
no outgoing calls
no test coverage detected