Add a test for dragging a range selection past the bottom of a panel

This is the other place that manages its own scroll position: while a
drag extends the selection to a line below the viewport, the view stays
put, and the drag autoscroller scrolls it one line at a time for as long
as the pointer stays there. Making the scroll automatic would centre the
selection instead, i.e. jump the view rather than scroll it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-08-14 08:04:13 +02:00
co-authored by Claude Opus 5
parent e9faf0325d
commit a85d6e0349
2 changed files with 38 additions and 0 deletions
+1
View File
@@ -500,6 +500,7 @@ var tests = []*components.IntegrationTest{
ui.BranchesNotFirstTab,
ui.CommitsNotFirstTab,
ui.DisableSwitchTabWithPanelJumpKeys,
ui.DragBeyondViewport,
ui.EmptyMenu,
ui.HideSidePanel,
ui.KeybindingSuggestionsDontCrashOnDisabledBindings,
@@ -0,0 +1,37 @@
package ui
import (
"fmt"
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DragBeyondViewport = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Dragging a range selection beyond the bottom of the panel doesn't scroll the view",
ExtraCmdArgs: []string{},
Skip: false,
Width: 120,
Height: 30,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
for i := range 20 {
shell.CreateFile(fmt.Sprintf("file%02d", i), "")
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Focus().
OriginY(0).
// The pointer ends up below the panel, so the range extends to a line
// that isn't visible. Scrolling there is the drag autoscroller's job,
// which scrolls line by line for as long as the pointer stays there;
// the drag itself must leave the scroll position alone.
ClickAndHold(1, 1).
MouseMove(1, 8).
MouseRelease().
SelectedLineIdx(8).
OriginY(0)
},
})