6 "github.com/aymanbagabas/go-udiff"
7 "github.com/charmbracelet/x/exp/slice"
10type splitHunk struct {
16type splitLine struct {
21func hunkToSplit(h *udiff.Hunk) (sh splitHunk) {
22 lines := slices.Clone(h.Lines)
26 lines: make([]*splitLine, 0, len(lines)),
32 ul, lines, ok = slice.Shift(lines)
40 // For equal lines, add as is
45 // For inserted lines, set after and keep before as nil
50 // For deleted lines, set before and loop over the next lines
51 // searching for the equivalent after line.
56 for i, l := range lines {
60 ll, lines, _ = slice.DeleteAt(lines, i)
69 sh.lines = append(sh.lines, &sl)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list