Skip to content

Commit

Permalink
fixup! Bump gocui
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhaller committed Jan 6, 2025
1 parent 6f2984e commit fe816c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ var MoveToIndexPartOfAdjacentAddedLines = NewIntegrationTest(NewIntegrationTestA
)

t.Views().Main().
Content(Contains("+1st line\n 2nd line\n"))
Content(Contains("+1st line\n 2nd line"))
},
})
8 changes: 4 additions & 4 deletions pkg/integration/tests/stash/stash_staged_partial_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ var StashStagedPartialFile = NewIntegrationTest(NewIntegrationTestArgs{

t.Views().Staging().
Content(
Contains(" line1\n-line2\n+line2 mod\n line3\n-line4\n+line4 mod\n"),
Contains(" line1\n-line2\n+line2 mod\n line3\n-line4\n+line4 mod"),
).
PressPrimaryAction().
PressPrimaryAction().
Content(
Contains(" line1\n line2 mod\n line3\n-line4\n+line4 mod\n"),
Contains(" line1\n line2 mod\n line3\n-line4\n+line4 mod"),
).
PressEscape()

Expand All @@ -54,7 +54,7 @@ var StashStagedPartialFile = NewIntegrationTest(NewIntegrationTestArgs{
)
t.Views().Main().
Content(
Contains(" line1\n-line2\n+line2 mod\n line3\n line4\n"),
Contains(" line1\n-line2\n+line2 mod\n line3\n line4"),
)

t.Views().Files().
Expand All @@ -64,7 +64,7 @@ var StashStagedPartialFile = NewIntegrationTest(NewIntegrationTestArgs{

t.Views().Staging().
Content(
Contains(" line1\n line2\n line3\n-line4\n+line4 mod\n"),
Contains(" line1\n line2\n line3\n-line4\n+line4 mod"),
)
},
})
1 change: 1 addition & 0 deletions pkg/utils/lines.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func ScanLinesAndTruncateWhenLongerThanBuffer(maxBufferSize int) func(data []byt
// If wrap is false, the text is returned as is.
// This code needs to behave the same as `gocui.lineWrap` does.
func WrapViewLinesToWidth(wrap bool, text string, width int) ([]string, []int, []int) {
text = strings.TrimSuffix(text, "\n")
lines := strings.Split(text, "\n")
if !wrap {
indices := make([]int, len(lines))
Expand Down
5 changes: 2 additions & 3 deletions pkg/utils/lines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,9 @@ func TestWrapViewLinesToWidth(t *testing.T) {
"longer.",
"Third",
"paragraph",
"",
},
expectedWrappedLinesIndices: []int{0, 2, 6, 8},
expectedOriginalLinesIndices: []int{0, 0, 1, 1, 1, 1, 2, 2, 3},
expectedWrappedLinesIndices: []int{0, 2, 6},
expectedOriginalLinesIndices: []int{0, 0, 1, 1, 1, 1, 2, 2},
},
}
for _, tt := range tests {
Expand Down

0 comments on commit fe816c7

Please sign in to comment.