Skip to content

Commit c0e3922

Browse files
authored
Fix flicker when showing backround fetch status (#4223)
- **PR Description** Fix occasional ugly flicker when showing the background fetch status (recently introduced with #4215). - **Please check if the PR fulfills these requirements** * [x] Cheatsheets are up-to-date (run `go generate ./...`) * [x] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [ ] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [ ] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [ ] If a new UserConfig entry was added, make sure it can be hot-reloaded (see [here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig)) * [ ] Docs have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc
2 parents d2723ff + 638c9c5 commit c0e3922

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pkg/gui/background.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ func (self *BackgroundRoutineMgr) startBackgroundFetch() {
7676
self.gui.waitForIntro.Wait()
7777

7878
fetch := func() error {
79-
return self.gui.PopupHandler.WithWaitingStatusSync(self.gui.Tr.FetchingStatus, func() error {
79+
return self.gui.helpers.AppStatus.WithWaitingStatusImpl(self.gui.Tr.FetchingStatus, func(gocui.Task) error {
8080
return self.backgroundFetch()
81-
})
81+
}, nil)
8282
}
8383

8484
// We want an immediate fetch at startup, and since goEvery starts by

pkg/gui/controllers/helpers/app_status_helper.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@ func (self appStatusHelperTask) Continue() {
6060
// withWaitingStatus wraps a function and shows a waiting status while the function is still executing
6161
func (self *AppStatusHelper) WithWaitingStatus(message string, f func(gocui.Task) error) {
6262
self.c.OnWorker(func(task gocui.Task) error {
63-
return self.statusMgr().WithWaitingStatus(message, self.renderAppStatus, func(waitingStatusHandle *status.WaitingStatusHandle) error {
64-
return f(appStatusHelperTask{task, waitingStatusHandle})
65-
})
63+
return self.WithWaitingStatusImpl(message, f, task)
64+
})
65+
}
66+
67+
func (self *AppStatusHelper) WithWaitingStatusImpl(message string, f func(gocui.Task) error, task gocui.Task) error {
68+
return self.statusMgr().WithWaitingStatus(message, self.renderAppStatus, func(waitingStatusHandle *status.WaitingStatusHandle) error {
69+
return f(appStatusHelperTask{task, waitingStatusHandle})
6670
})
6771
}
6872

0 commit comments

Comments
 (0)