From 3aab37611a26834af8348441d864ecad3eb15674 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Thu, 19 Mar 2020 09:14:59 +1100 Subject: [PATCH] show status of selected cherry picked commits --- pkg/gui/gui.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 42f4bfc75..1ae9199eb 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -213,6 +213,7 @@ type guiState struct { Ptmx *os.File PrevMainWidth int PrevMainHeight int + OldInformation string } // for now the split view will always be on @@ -494,6 +495,9 @@ func (gui *Gui) layout(g *gocui.Gui) error { donate := color.New(color.FgMagenta, color.Underline).Sprint(gui.Tr.SLocalize("Donate")) information = donate + " " + information } + if len(gui.State.CherryPickedCommits) > 0 { + information = utils.ColoredString(fmt.Sprintf("%d commits copied", len(gui.State.CherryPickedCommits)), color.FgCyan) + } minimumHeight := 9 minimumWidth := 10 @@ -760,13 +764,14 @@ func (gui *Gui) layout(g *gocui.Gui) error { } } - if v, err := g.SetView("information", optionsVersionBoundary-1, height-2, width, height, 0); err != nil { + informationView, err := g.SetView("information", optionsVersionBoundary-1, height-2, width, height, 0) + if err != nil { if err.Error() != "unknown view" { return err } - v.BgColor = gocui.ColorDefault - v.FgColor = gocui.ColorGreen - v.Frame = false + informationView.BgColor = gocui.ColorDefault + informationView.FgColor = gocui.ColorGreen + informationView.Frame = false gui.renderString(g, "information", information) // doing this here because it'll only happen once @@ -774,6 +779,10 @@ func (gui *Gui) layout(g *gocui.Gui) error { return err } } + if gui.State.OldInformation != information { + gui.setViewContent(g, informationView, information) + gui.State.OldInformation = information + } if gui.g.CurrentView() == nil { if _, err := gui.g.SetCurrentView(gui.getFilesView().Name()); err != nil {