Files
lazygit/pkg/integration/tests/main_view/wrap_only_the_diff.go
Stefan HallerandClaude Opus 5 0b47b0013a Let wrapLinesInDiffView govern the two main panes
Working in a diff used to mean the staging view, and this option said
whether the long lines there were wrapped. The main view does that work
now, and the option has had nothing to govern since the staging view went
away. Both panes wrap whatever they are given.

Make the option their wrap setting instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-05 11:44:42 +02:00

43 lines
1.2 KiB
Go

package main_view
import (
"strings"
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var longLine = "start " + strings.Repeat("word ", 40) + "end"
var WrapOnlyTheDiff = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Turning wrapping off for diffs leaves everything else the main view shows wrapped",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Gui.WrapLinesInDiffView = false
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "one\n")
shell.Commit(longLine)
shell.UpdateFile("file1", "one\n"+longLine+"\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// The option is about diffs, so the added line runs off the edge of the pane in
// one piece.
t.Views().Files().
IsFocused().
Tap(func() {
t.Views().Main().ContainsViewLines(Contains("start").Contains("end"))
})
// A branch's commit log is no diff, and the option leaves it alone: the same
// text is laid out over as many lines as it takes.
t.Views().Branches().
Focus()
t.Views().Main().
ContainsViewLines(Contains("end").DoesNotContain("start"))
},
})