diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-12-22 17:31:13 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-01-14 17:45:35 +0100 |
commit | 99a3ccde71ceebcbf8045655ef604a1965e64a5a (patch) | |
tree | bb66b951db6d0bdfa84c82e94aec4105a234fcc8 /pkg/gui/controllers/helpers/app_status_helper.go | |
parent | 8ca8a4396859559d818c2b5a51411da7d618ee70 (diff) |
Add ErrorToast function
Diffstat (limited to 'pkg/gui/controllers/helpers/app_status_helper.go')
-rw-r--r-- | pkg/gui/controllers/helpers/app_status_helper.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pkg/gui/controllers/helpers/app_status_helper.go b/pkg/gui/controllers/helpers/app_status_helper.go index 8e4741bd5..fd6bc247f 100644 --- a/pkg/gui/controllers/helpers/app_status_helper.go +++ b/pkg/gui/controllers/helpers/app_status_helper.go @@ -5,6 +5,7 @@ import ( "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/gui/status" + "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -23,7 +24,7 @@ func NewAppStatusHelper(c *HelperCommon, statusMgr func() *status.StatusManager, } } -func (self *AppStatusHelper) Toast(message string) { +func (self *AppStatusHelper) Toast(message string, kind types.ToastKind) { if self.c.RunningIntegrationTest() { // Don't bother showing toasts in integration tests. You can't check for // them anyway, and they would only slow down the test unnecessarily by @@ -31,7 +32,7 @@ func (self *AppStatusHelper) Toast(message string) { return } - self.statusMgr().AddToastStatus(message) + self.statusMgr().AddToastStatus(message, kind) self.renderAppStatus() } @@ -87,7 +88,8 @@ func (self *AppStatusHelper) HasStatus() bool { } func (self *AppStatusHelper) GetStatusString() string { - return self.statusMgr().GetStatusString() + appStatus, _ := self.statusMgr().GetStatusString() + return appStatus } func (self *AppStatusHelper) renderAppStatus() { @@ -95,7 +97,8 @@ func (self *AppStatusHelper) renderAppStatus() { ticker := time.NewTicker(time.Millisecond * utils.LoaderAnimationInterval) defer ticker.Stop() for range ticker.C { - appStatus := self.statusMgr().GetStatusString() + appStatus, color := self.statusMgr().GetStatusString() + self.c.Views().AppStatus.FgColor = color self.c.OnUIThread(func() error { self.c.SetViewContent(self.c.Views().AppStatus, appStatus) return nil @@ -127,7 +130,8 @@ func (self *AppStatusHelper) renderAppStatusSync(stop chan struct{}) { for { select { case <-ticker.C: - appStatus := self.statusMgr().GetStatusString() + appStatus, color := self.statusMgr().GetStatusString() + self.c.Views().AppStatus.FgColor = color self.c.SetViewContent(self.c.Views().AppStatus, appStatus) // Redraw all views of the bottom line: bottomLineViews := []*gocui.View{ |