From 35753fd042dda6974cb6d7c2a029d43d3b4e50a1 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 26 Aug 2026 18:53:55 +0200 Subject: [PATCH] Fix scrolling back when dragging a commit During auto-scrolling, turn off the automatic scroll-to-make-the-selected-item-visible functionality of PostRefreshUpdate. --- pkg/gui/controllers/local_commits_controller.go | 2 +- .../interactive_rebase/drag_to_reorder_with_autoscroll.go | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 0a02e7398..9407e3dee 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -191,7 +191,7 @@ func (self *LocalCommitsController) handleCommitDrag(opts gocui.ViewMouseBinding self.commitDrag.hasMoved = true if self.updateCommitDragInsertion(opts.Y) { - self.c.PostRefreshUpdate(self.context()) + self.c.PostRefreshUpdateKeepingScrollPosition(self.context()) } originY := self.context().GetView().OriginY() self.dragAutoscroller.Update(opts.Y - originY) diff --git a/pkg/integration/tests/interactive_rebase/drag_to_reorder_with_autoscroll.go b/pkg/integration/tests/interactive_rebase/drag_to_reorder_with_autoscroll.go index 6d281aa06..fdfdb8bc8 100644 --- a/pkg/integration/tests/interactive_rebase/drag_to_reorder_with_autoscroll.go +++ b/pkg/integration/tests/interactive_rebase/drag_to_reorder_with_autoscroll.go @@ -27,12 +27,8 @@ var DragToReorderWithAutoscroll = NewIntegrationTest(NewIntegrationTestArgs{ OriginYAtLeast(3). // Move the mouse back into the viewport MouseMove(1, 1). - /* EXPECTED: // This keeps the scroll as it was OriginYAtLeast(3). - ACTUAL: */ - // This snaps back to reveal the original commit - OriginY(0). MouseRelease(). SelectedLines( Contains("commit-40"),