diff options
Diffstat (limited to 'pkg/gui/layout.go')
-rw-r--r-- | pkg/gui/layout.go | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index ceb858973..f9178262c 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -71,23 +71,27 @@ func (gui *Gui) onFocus(v *gocui.View) error { return nil } +func (gui *Gui) informationStr() string { + if gui.inDiffMode() { + return utils.ColoredString(fmt.Sprintf("%s %s %s", gui.Tr.SLocalize("showingGitDiff"), "git diff "+gui.diffStr(), utils.ColoredString(gui.Tr.SLocalize("(reset)"), color.Underline)), color.FgMagenta) + } else if gui.inFilterMode() { + return utils.ColoredString(fmt.Sprintf("%s '%s' %s", gui.Tr.SLocalize("filteringBy"), gui.State.FilterPath, utils.ColoredString(gui.Tr.SLocalize("(reset)"), color.Underline)), color.FgRed, color.Bold) + } else if len(gui.State.CherryPickedCommits) > 0 { + return utils.ColoredString(fmt.Sprintf("%d commits copied", len(gui.State.CherryPickedCommits)), color.FgCyan) + } else if gui.g.Mouse { + donate := color.New(color.FgMagenta, color.Underline).Sprint(gui.Tr.SLocalize("Donate")) + return donate + " " + gui.Config.GetVersion() + } else { + return gui.Config.GetVersion() + } +} + // layout is called for every screen re-render e.g. when the screen is resized func (gui *Gui) layout(g *gocui.Gui) error { g.Highlight = true width, height := g.Size() - information := gui.Config.GetVersion() - if gui.g.Mouse { - donate := color.New(color.FgMagenta, color.Underline).Sprint(gui.Tr.SLocalize("Donate")) - information = donate + " " + information - } - if gui.inDiffMode() { - information = utils.ColoredString(fmt.Sprintf("%s %s %s", gui.Tr.SLocalize("showingGitDiff"), "git diff "+gui.diffStr(), utils.ColoredString(gui.Tr.SLocalize("(reset)"), color.Underline)), color.FgMagenta) - } else if gui.inFilterMode() { - information = utils.ColoredString(fmt.Sprintf("%s '%s' %s", gui.Tr.SLocalize("filteringBy"), gui.State.FilterPath, utils.ColoredString(gui.Tr.SLocalize("(reset)"), color.Underline)), color.FgRed, color.Bold) - } else if len(gui.State.CherryPickedCommits) > 0 { - information = utils.ColoredString(fmt.Sprintf("%d commits copied", len(gui.State.CherryPickedCommits)), color.FgCyan) - } + information := gui.informationStr() minimumHeight := 9 minimumWidth := 10 |