on main help sign in
ci: fix diffview tests on ci on windows
commit95f5e75458eb471ef7cba3c0b5a39000284e2823 authorAndrey Nering <andreynering@users.noreply.github.com> dateFri 11 Jul 2025, 17:25 (1 year ago) parentfb21333
1 file changed+4−2
internal/tui/exp/diffview/diffview.go+4−2
internal/tui/exp/diffview/diffview.go+4−2
@@ -365,7 +365,8 @@ func (dv *DiffView) renderUnified() string {
365365 shouldWrite := func() bool { return printedLines >= 0 }
366366
367367 getContent := func(in string, ls LineStyle) (content string, leadingEllipsis bool) {
368− content = strings.TrimSuffix(in, "\n")
368+ content = strings.ReplaceAll(in, "\r\n", "\n")
369+ content = strings.TrimSuffix(content, "\n")
369370 content = dv.hightlightCode(content, ls.Code.GetBackground())
370371 content = ansi.GraphemeWidth.Cut(content, dv.xOffset, len(content))
371372 content = ansi.Truncate(content, dv.codeWidth, "…")
@@ -488,7 +489,8 @@ func (dv *DiffView) renderSplit() string {
488489 shouldWrite := func() bool { return printedLines >= 0 }
489490
490491 getContent := func(in string, ls LineStyle) (content string, leadingEllipsis bool) {
491− content = strings.TrimSuffix(in, "\n")
492+ content = strings.ReplaceAll(in, "\r\n", "\n")
493+ content = strings.TrimSuffix(content, "\n")
492494 content = dv.hightlightCode(content, ls.Code.GetBackground())
493495 content = ansi.GraphemeWidth.Cut(content, dv.xOffset, len(content))
494496 content = ansi.Truncate(content, dv.codeWidth, "…")