From c18d8af9f4e91e19f9d4f7746c044691a25b846d Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 28 Feb 2025 13:08:44 +0100 Subject: [PATCH] Use a WithWaitingStatus for rewording a non-head commit Rewording a commit at the beginning of a long branch can take very long; without this change, the commit message panel would stay visible with a blinking cursor during that time, which is very confusing. This has the slight downside that it will say "Rebasing" in the lower right corner until the operation is done; but we already have this problem when doing custom patch operations, or dropping changes from a commit, so it's not new, and we can think about how to fix all these another time. --- pkg/gui/controllers/local_commits_controller.go | 12 +++++++----- pkg/i18n/english.go | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index a57ec26c5..a94cc0c82 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -415,11 +415,13 @@ func (self *LocalCommitsController) handleReword(summary string, description str self.c.Tr.CommittingStatus, nil) } - err := self.c.Git().Rebase.RewordCommit(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx(), summary, description) - if err != nil { - return err - } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) + return self.c.WithWaitingStatus(self.c.Tr.RewordingStatus, func(gocui.Task) error { + err := self.c.Git().Rebase.RewordCommit(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx(), summary, description) + if err != nil { + return err + } + return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) + }) } func (self *LocalCommitsController) doRewordEditor() error { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 81620e47b..977f6863c 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -384,6 +384,7 @@ type TranslationSet struct { RedoingStatus string CheckingOutStatus string CommittingStatus string + RewordingStatus string RevertingStatus string CreatingFixupCommitStatus string CommitFiles string @@ -1425,6 +1426,7 @@ func EnglishTranslationSet() *TranslationSet { RedoingStatus: "Redoing", CheckingOutStatus: "Checking out", CommittingStatus: "Committing", + RewordingStatus: "Rewording", RevertingStatus: "Reverting", CreatingFixupCommitStatus: "Creating fixup commit", CommitFiles: "Commit files",