feat(diffview): prevent infinite vertical scroll by default

Andrey Nering created

Change summary

internal/exp/diffview/Taskfile.yaml                                                   | 20 
internal/exp/diffview/diffview.go                                                     | 65 
internal/exp/diffview/diffview_test.go                                                | 27 
internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf11.golden           |  1 
internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf12.golden           |  2 
internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf13.golden           |  2 
internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf14.golden           |  7 
internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf15.golden           |  7 
internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf16.golden           |  7 
internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf12.golden         |  4 
internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf13.golden         |  6 
internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf14.golden         |  8 
internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf15.golden         | 10 
internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf16.golden         | 10 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf00.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf01.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf02.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf03.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf04.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf05.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf06.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf07.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf08.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf09.golden   |  3 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf10.golden   |  2 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf11.golden   |  1 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf12.golden   |  0 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf13.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf14.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf15.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf16.golden   |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf00.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf01.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf02.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf03.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf04.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf05.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf06.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf07.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf08.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf09.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf10.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf11.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf12.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf13.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf14.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf15.golden |  5 
internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf16.golden |  5 
48 files changed, 286 insertions(+), 46 deletions(-)

Detailed changes

internal/exp/diffview/Taskfile.yaml šŸ”—

@@ -100,3 +100,23 @@ tasks:
       - for: sources
         cmd: echo && echo "------- {{.ITEM}} -------" && echo && cat {{.ITEM}}
     silent: true
+
+  test:print:yoffset:unified:infinite:
+    desc: Print golden files for debugging
+    method: none
+    sources:
+      - ./testdata/TestDiffViewYOffsetInfinite/Unified/*.golden
+    cmds:
+      - for: sources
+        cmd: echo && echo "------- {{.ITEM}} -------" && echo && cat {{.ITEM}}
+    silent: true
+
+  test:print:yoffset:split:infinite:
+    desc: Print golden files for debugging
+    method: none
+    sources:
+      - ./testdata/TestDiffViewYOffsetInfinite/Split/*.golden
+    cmds:
+      - for: sources
+        cmd: echo && echo "------- {{.ITEM}} -------" && echo && cat {{.ITEM}}
+    silent: true

internal/exp/diffview/diffview.go šŸ”—

@@ -33,18 +33,19 @@ const (
 
 // DiffView represents a view for displaying differences between two files.
 type DiffView struct {
-	layout       layout
-	before       file
-	after        file
-	contextLines int
-	lineNumbers  bool
-	height       int
-	width        int
-	xOffset      int
-	yOffset      int
-	style        Style
-	tabWidth     int
-	chromaStyle  *chroma.Style
+	layout          layout
+	before          file
+	after           file
+	contextLines    int
+	lineNumbers     bool
+	height          int
+	width           int
+	xOffset         int
+	yOffset         int
+	infiniteYScroll bool
+	style           Style
+	tabWidth        int
+	chromaStyle     *chroma.Style
 
 	isComputed bool
 	err        error
@@ -53,6 +54,7 @@ type DiffView struct {
 
 	splitHunks []splitHunk
 
+	totalLines      int
 	codeWidth       int
 	fullCodeWidth   int  // with leading symbols
 	extraColOnAfter bool // add extra column on after panel
@@ -138,6 +140,12 @@ func (dv *DiffView) YOffset(yOffset int) *DiffView {
 	return dv
 }
 
+// InfiniteYScroll allows the YOffset to scroll beyond the last line.
+func (dv *DiffView) InfiniteYScroll(infiniteYScroll bool) *DiffView {
+	dv.infiniteYScroll = infiniteYScroll
+	return dv
+}
+
 // TabWidth sets the tab width. Only relevant for code that contains tabs, like
 // Go code.
 func (dv *DiffView) TabWidth(tabWidth int) *DiffView {
@@ -161,6 +169,8 @@ func (dv *DiffView) String() string {
 	dv.convertDiffToSplit()
 	dv.adjustStyles()
 	dv.detectNumDigits()
+	dv.detectTotalLines()
+	dv.preventInfiniteYScroll()
 
 	if dv.width <= 0 {
 		dv.detectCodeWidth()
@@ -251,6 +261,37 @@ func (dv *DiffView) detectNumDigits() {
 	}
 }
 
+func (dv *DiffView) detectTotalLines() {
+	dv.totalLines = 0
+
+	switch dv.layout {
+	case layoutUnified:
+		for _, h := range dv.unified.Hunks {
+			dv.totalLines += 1 + len(h.Lines)
+		}
+	case layoutSplit:
+		for _, h := range dv.splitHunks {
+			dv.totalLines += 1 + len(h.lines)
+		}
+	}
+}
+
+func (dv *DiffView) preventInfiniteYScroll() {
+	if dv.infiniteYScroll {
+		return
+	}
+
+	// clamp yOffset to prevent scrolling beyond the last line
+	if dv.height > 0 {
+		maxYOffset := max(0, dv.totalLines-dv.height)
+		dv.yOffset = min(dv.yOffset, maxYOffset)
+	} else {
+		// if no height limit, ensure yOffset doesn't exceed total lines
+		dv.yOffset = min(dv.yOffset, max(0, dv.totalLines-1))
+	}
+	dv.yOffset = max(0, dv.yOffset) // ensure yOffset is not negative
+}
+
 // detectCodeWidth calculates the maximum width of code lines in the diff view.
 func (dv *DiffView) detectCodeWidth() {
 	switch dv.layout {

internal/exp/diffview/diffview_test.go šŸ”—

@@ -283,6 +283,33 @@ func TestDiffViewYOffset(t *testing.T) {
 	}
 }
 
+func TestDiffViewYOffsetInfinite(t *testing.T) {
+	for layoutName, layoutFunc := range LayoutFuncs {
+		t.Run(layoutName, func(t *testing.T) {
+			for yOffset := range 17 {
+				t.Run(fmt.Sprintf("YOffsetOf%02d", yOffset), func(t *testing.T) {
+					t.Parallel()
+
+					dv := diffview.New().
+						Before("main.go", TestMultipleHunksBefore).
+						After("main.go", TestMultipleHunksAfter).
+						Style(diffview.DefaultLightStyle()).
+						ChromaStyle(styles.Get("catppuccin-latte")).
+						Height(5).
+						YOffset(yOffset).
+						InfiniteYScroll(true)
+					dv = layoutFunc(dv)
+
+					output := dv.String()
+					golden.RequireEqual(t, []byte(output))
+
+					assertHeight(t, 5, output)
+				})
+			}
+		})
+	}
+}
+
 func assertLineWidth(t *testing.T, expected int, output string) {
 	var lineWidth int
 	for line := range strings.SplitSeq(output, "\n") {

internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf11.golden šŸ”—

@@ -1,5 +1,5 @@
+Ā 10Ā                                                   Ā 11Ā                                                   
 Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf12.golden šŸ”—

@@ -1,5 +1,5 @@
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf13.golden šŸ”—

@@ -1,5 +1,5 @@
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf14.golden šŸ”—

@@ -1,5 +1,5 @@
-Ā 13Ā   }                                               Ā 15Ā   }                                               
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf15.golden šŸ”—

@@ -1,5 +1,5 @@
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffset/Split/YOffsetOf16.golden šŸ”—

@@ -1,5 +1,5 @@
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
-Ā   Ā                                                   Ā   Ā                                                   
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf12.golden šŸ”—

@@ -1,5 +1,5 @@
+Ā 11Ā Ā 12Ā   func getContent() string {                      
 Ā 12Ā Ā   Ā -     return "Hello, world!"                      
 Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
 Ā   Ā Ā 14Ā +     return content                              
-Ā 13Ā Ā 15Ā   }                                               
-Ā   Ā Ā   Ā                                                   
+Ā 13Ā Ā 15Ā   }                                               

internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf13.golden šŸ”—

@@ -1,5 +1,5 @@
+Ā 11Ā Ā 12Ā   func getContent() string {                      
+Ā 12Ā Ā   Ā -     return "Hello, world!"                      
 Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
 Ā   Ā Ā 14Ā +     return content                              
-Ā 13Ā Ā 15Ā   }                                               
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
+Ā 13Ā Ā 15Ā   }                                               

internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf14.golden šŸ”—

@@ -1,5 +1,5 @@
+Ā 11Ā Ā 12Ā   func getContent() string {                      
+Ā 12Ā Ā   Ā -     return "Hello, world!"                      
+Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
 Ā   Ā Ā 14Ā +     return content                              
-Ā 13Ā Ā 15Ā   }                                               
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
+Ā 13Ā Ā 15Ā   }                                               

internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf15.golden šŸ”—

@@ -1,5 +1,5 @@
-Ā 13Ā Ā 15Ā   }                                               
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
+Ā 11Ā Ā 12Ā   func getContent() string {                      
+Ā 12Ā Ā   Ā -     return "Hello, world!"                      
+Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
+Ā   Ā Ā 14Ā +     return content                              
+Ā 13Ā Ā 15Ā   }                                               

internal/exp/diffview/testdata/TestDiffViewYOffset/Unified/YOffsetOf16.golden šŸ”—

@@ -1,5 +1,5 @@
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
-Ā   Ā Ā   Ā                                                   
+Ā 11Ā Ā 12Ā   func getContent() string {                      
+Ā 12Ā Ā   Ā -     return "Hello, world!"                      
+Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
+Ā   Ā Ā 14Ā +     return content                              
+Ā 13Ā Ā 15Ā   }                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf00.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  …Ā   @@ -2,6 +2,7 @@                                 Ā  …Ā                                                   
+Ā  2Ā                                                   Ā  2Ā                                                   
+Ā  3Ā   import (                                        Ā  3Ā   import (                                        
+Ā  4Ā       "fmt"                                       Ā  4Ā       "fmt"                                       
+Ā  …Ā   …                                               Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf01.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  2Ā                                                   Ā  2Ā                                                   
+Ā  3Ā   import (                                        Ā  3Ā   import (                                        
+Ā  4Ā       "fmt"                                       Ā  4Ā       "fmt"                                       
+Ā   Ā                                                   Ā  5Ā +     "strings"                                   
+Ā  …Ā   …                                               Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf02.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  3Ā   import (                                        Ā  3Ā   import (                                        
+Ā  4Ā       "fmt"                                       Ā  4Ā       "fmt"                                       
+Ā   Ā                                                   Ā  5Ā +     "strings"                                   
+Ā  5Ā   )                                               Ā  6Ā   )                                               
+Ā  …Ā   …                                               Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf03.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  4Ā       "fmt"                                       Ā  4Ā       "fmt"                                       
+Ā   Ā                                                   Ā  5Ā +     "strings"                                   
+Ā  5Ā   )                                               Ā  6Ā   )                                               
+Ā  6Ā                                                   Ā  7Ā                                                   
+Ā  …Ā   …                                               Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf04.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā   Ā                                                   Ā  5Ā +     "strings"                                   
+Ā  5Ā   )                                               Ā  6Ā   )                                               
+Ā  6Ā                                                   Ā  7Ā                                                   
+Ā  7Ā   func main() {                                   Ā  8Ā   func main() {                                   
+Ā  …Ā   @@ -9,5 +10,6 @@                                Ā  …Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf05.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  5Ā   )                                               Ā  6Ā   )                                               
+Ā  6Ā                                                   Ā  7Ā                                                   
+Ā  7Ā   func main() {                                   Ā  8Ā   func main() {                                   
+Ā  …Ā   @@ -9,5 +10,6 @@                                Ā  …Ā                                                   
+Ā  …Ā   …                                               Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf06.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  6Ā                                                   Ā  7Ā                                                   
+Ā  7Ā   func main() {                                   Ā  8Ā   func main() {                                   
+Ā  …Ā   @@ -9,5 +10,6 @@                                Ā  …Ā                                                   
+Ā  9Ā   }                                               Ā 10Ā   }                                               
+Ā  …Ā   …                                               Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf07.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  7Ā   func main() {                                   Ā  8Ā   func main() {                                   
+Ā  …Ā   @@ -9,5 +10,6 @@                                Ā  …Ā                                                   
+Ā  9Ā   }                                               Ā 10Ā   }                                               
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā  …Ā   …                                               Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf08.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  …Ā   @@ -9,5 +10,6 @@                                Ā  …Ā                                                   
+Ā  9Ā   }                                               Ā 10Ā   }                                               
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      
+Ā  …Ā   …                                               Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf09.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  9Ā   }                                               Ā 10Ā   }                                               
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf10.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā 10Ā                                                   Ā 11Ā                                                   
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf11.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā 11Ā   func getContent() string {                      Ā 12Ā   func getContent() string {                      

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf13.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā   Ā                                                   Ā 14Ā +     return content                              
+Ā 13Ā   }                                               Ā 15Ā   }                                               
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf14.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā 13Ā   }                                               Ā 15Ā   }                                               
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf15.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Split/YOffsetOf16.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   
+Ā   Ā                                                   Ā   Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf00.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  …Ā Ā  …Ā   @@ -2,6 +2,7 @@                                 
+Ā  2Ā Ā  2Ā                                                   
+Ā  3Ā Ā  3Ā   import (                                        
+Ā  4Ā Ā  4Ā       "fmt"                                       
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf01.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  2Ā Ā  2Ā                                                   
+Ā  3Ā Ā  3Ā   import (                                        
+Ā  4Ā Ā  4Ā       "fmt"                                       
+Ā   Ā Ā  5Ā +     "strings"                                   
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf02.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  3Ā Ā  3Ā   import (                                        
+Ā  4Ā Ā  4Ā       "fmt"                                       
+Ā   Ā Ā  5Ā +     "strings"                                   
+Ā  5Ā Ā  6Ā   )                                               
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf03.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  4Ā Ā  4Ā       "fmt"                                       
+Ā   Ā Ā  5Ā +     "strings"                                   
+Ā  5Ā Ā  6Ā   )                                               
+Ā  6Ā Ā  7Ā                                                   
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf04.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā   Ā Ā  5Ā +     "strings"                                   
+Ā  5Ā Ā  6Ā   )                                               
+Ā  6Ā Ā  7Ā                                                   
+Ā  7Ā Ā  8Ā   func main() {                                   
+Ā  …Ā Ā  …Ā   @@ -9,5 +10,6 @@                                

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf05.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  5Ā Ā  6Ā   )                                               
+Ā  6Ā Ā  7Ā                                                   
+Ā  7Ā Ā  8Ā   func main() {                                   
+Ā  …Ā Ā  …Ā   @@ -9,5 +10,6 @@                                
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf06.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  6Ā Ā  7Ā                                                   
+Ā  7Ā Ā  8Ā   func main() {                                   
+Ā  …Ā Ā  …Ā   @@ -9,5 +10,6 @@                                
+Ā  9Ā Ā 10Ā   }                                               
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf07.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  7Ā Ā  8Ā   func main() {                                   
+Ā  …Ā Ā  …Ā   @@ -9,5 +10,6 @@                                
+Ā  9Ā Ā 10Ā   }                                               
+Ā 10Ā Ā 11Ā                                                   
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf08.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  …Ā Ā  …Ā   @@ -9,5 +10,6 @@                                
+Ā  9Ā Ā 10Ā   }                                               
+Ā 10Ā Ā 11Ā                                                   
+Ā 11Ā Ā 12Ā   func getContent() string {                      
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf09.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā  9Ā Ā 10Ā   }                                               
+Ā 10Ā Ā 11Ā                                                   
+Ā 11Ā Ā 12Ā   func getContent() string {                      
+Ā 12Ā Ā   Ā -     return "Hello, world!"                      
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf10.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā 10Ā Ā 11Ā                                                   
+Ā 11Ā Ā 12Ā   func getContent() string {                      
+Ā 12Ā Ā   Ā -     return "Hello, world!"                      
+Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
+Ā  …Ā Ā  …Ā   …                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf11.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā 11Ā Ā 12Ā   func getContent() string {                      
+Ā 12Ā Ā   Ā -     return "Hello, world!"                      
+Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
+Ā   Ā Ā 14Ā +     return content                              
+Ā 13Ā Ā 15Ā   }                                               

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf12.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā 12Ā Ā   Ā -     return "Hello, world!"                      
+Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
+Ā   Ā Ā 14Ā +     return content                              
+Ā 13Ā Ā 15Ā   }                                               
+Ā   Ā Ā   Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf13.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā   Ā Ā 13Ā +     content := strings.ToUpper("Hello, World!") 
+Ā   Ā Ā 14Ā +     return content                              
+Ā 13Ā Ā 15Ā   }                                               
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf14.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā   Ā Ā 14Ā +     return content                              
+Ā 13Ā Ā 15Ā   }                                               
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf15.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā 13Ā Ā 15Ā   }                                               
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   

internal/exp/diffview/testdata/TestDiffViewYOffsetInfinite/Unified/YOffsetOf16.golden šŸ”—

@@ -0,0 +1,5 @@
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā                                                   
+Ā   Ā Ā   Ā