fix: git diff blob excerpt (#38808)

1. refactor the legacy code and add more comments, remove the "+1/-1"
tricks, clarify the BuildBlobExcerptDiffSection behavior
2. fix a line-counting bug (see screenshot below)
This commit is contained in:
wxiaoguang
2026-08-07 10:44:55 +08:00
committed by GitHub
parent 9dac77fdc2
commit a7df0d5f41
5 changed files with 98 additions and 56 deletions
+2 -2
View File
@@ -98,8 +98,8 @@ func TestGetDiffForRender(t *testing.T) {
ExpandDirection: "down",
LastLeftIdx: 76,
LastRightIdx: 73,
LeftIdx: 104,
RightIdx: 101,
LeftIdx: 103, // left has 103 lines
RightIdx: 100, // right has 100 lines
},
}
for idx, exp := range expectedSections {