- commit
- 8c6451c
- parent
- faecaa7
- author
- Eric Bower
- date
- 2025-12-13 12:37:11 -0500 EST
chore: trying to diff only things that changed
1 files changed,
+21,
-15
+21,
-15
1@@ -116,13 +116,7 @@ func toRangeDiffDiff(diff []diffmatchpatch.Diff) []RangeDiffDiff {
2 result := []RangeDiffDiff{}
3
4 for _, line := range diff {
5- outer := "equal"
6- switch line.Type {
7- case diffmatchpatch.DiffInsert:
8- outer = "insert"
9- case diffmatchpatch.DiffDelete:
10- outer = "delete"
11- }
12+ outerDiffType := line.Type
13
14 fmtLine := strings.Split(line.Text, "\n")
15 for idx, ln := range fmtLine {
16@@ -130,16 +124,28 @@ func toRangeDiffDiff(diff []diffmatchpatch.Diff) []RangeDiffDiff {
17 if idx < len(fmtLine)-1 {
18 text = ln + "\n"
19 }
20- st := RangeDiffDiff{
21- Text: text,
22- OuterType: outer,
23- InnerType: "equal",
24- }
25
26+ // Determine inner type based on line prefix (+/-/space)
27+ inner := "equal"
28 if strings.HasPrefix(text, "+") {
29- st.InnerType = "insert"
30+ inner = "insert"
31 } else if strings.HasPrefix(text, "-") {
32- st.InnerType = "delete"
33+ inner = "delete"
34+ }
35+
36+ // Determine outer type based on diff result
37+ outer := "equal"
38+ switch outerDiffType {
39+ case diffmatchpatch.DiffInsert:
40+ outer = "insert"
41+ case diffmatchpatch.DiffDelete:
42+ outer = "delete"
43+ }
44+
45+ st := RangeDiffDiff{
46+ Text: text,
47+ OuterType: outer,
48+ InnerType: inner,
49 }
50
51 result = append(result, st)
52@@ -209,7 +215,7 @@ func outputDiff(patchA, patchB *PatchRange) []*RangeDiffFile {
53 // No difference in actual changes, skip this file
54 continue
55 }
56- // Use full lines (with context) for display
57+ // Use all lines (with context) for display
58 strA := extractAllLines(fileA)
59 strB := extractAllLines(fileB)
60 curDiff := DoDiff(strA, strB)