Fix the main view display after reverting a commit (#5138)

After reverting a commit, the main view would show the diff of a commit
that is not the selected one.
This commit is contained in:
Stefan Haller 2025-12-23 14:59:28 +01:00 committed by GitHub
commit 74b1255b4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -869,7 +869,7 @@ func (self *LocalCommitsController) revert(commits []*models.Commit, start, end
return err
}
self.context().MoveSelection(len(commits))
self.context().FocusLine()
self.context().HandleFocus(types.OnFocusOpts{})
if mustStash {
if err := self.c.Git().Stash.Pop(0); err != nil {

View file

@ -32,6 +32,9 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
Contains("Revert \"first commit\""),
Contains("first commit").IsSelected(),
).
Tap(func() {
t.Views().Main().Content(Contains("+myfile content"))
}).
SelectPreviousItem()
t.Views().Main().Content(Contains("-myfile content"))