Skip to content

Commit a415d1b

Browse files
committed
Fix the main view display after reverting a commit
We move the selection down by the number of commits that were reverted (to keep the same commits selected). However, this only happens after refreshing, which has rendered the main view with the wrong commit, so we need to render it again after moving the selection. There are many other callers of MoveSelection in LocalCommitsController, but all of them happen before the refresh. Revert is special because it needs to move the selection after refreshing, e.g. when reverting the only commit of a branch.
1 parent 0a48f30 commit a415d1b

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

pkg/gui/controllers/local_commits_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ func (self *LocalCommitsController) revert(commits []*models.Commit, start, end
869869
return err
870870
}
871871
self.context().MoveSelection(len(commits))
872-
self.context().FocusLine()
872+
self.context().HandleFocus(types.OnFocusOpts{})
873873

874874
if mustStash {
875875
if err := self.c.Git().Stash.Pop(0); err != nil {

pkg/integration/tests/commit/revert.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
3333
Contains("first commit").IsSelected(),
3434
).
3535
Tap(func() {
36-
/* EXPECTED:
3736
t.Views().Main().Content(Contains("+myfile content"))
38-
ACTUAL: */
39-
t.Views().Main().Content(Contains("-myfile content"))
4037
}).
4138
SelectPreviousItem()
4239

0 commit comments

Comments
 (0)