File size: 728 Bytes
7f0ec95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import type Git from '../../../hooks/git'
import { WIDE_LINE_LETTERS } from './wide-line-letters.js'

/**
 * A hunk of wide lines cycling context, removed and added: at its defaults
 * two share a `Code` and three do not.
 *
 * @param start the first line's number on both sides
 * @param count how many lines
 * @param letter the character each line repeats WIDE_LINE_LETTERS times
 * @returns the hunk
 */
export function wideHunk(start = 1, count = 40, letter = 'x'): Git.Hunk {
  const markers = [' ', '-', '+']

  return {
    oldStart: start,
    newStart: start,
    lines: Array.from(
      { length: count },
      (_, row) =>
        `${markers[row % markers.length]}${letter.repeat(WIDE_LINE_LETTERS)}`,
    ),
  }
}