From e4f0a470e93e6522757cb8fc215a245de92a8e75 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 11 Apr 2021 21:42:18 +1000 Subject: [PATCH] print header for command log --- pkg/gui/layout.go | 13 +++++++++++++ pkg/i18n/english.go | 2 ++ 2 files changed, 15 insertions(+) diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 07ffb2814..57759dc85 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -1,8 +1,12 @@ package gui import ( + "fmt" + + "github.com/fatih/color" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/theme" + "github.com/jesseduffield/lazygit/pkg/utils" ) const SEARCH_PREFIX = "search: " @@ -121,6 +125,7 @@ func (gui *Gui) createAllViews() error { gui.Views.Extras.Title = gui.Tr.CommandLog gui.Views.Extras.FgColor = theme.GocuiDefaultTextColor gui.Views.Extras.Autoscroll = true + gui.printCommandLogHeader() if _, err := gui.g.SetCurrentView(gui.defaultSideContext().GetViewName()); err != nil { return err @@ -129,6 +134,14 @@ func (gui *Gui) createAllViews() error { return nil } +func (gui *Gui) printCommandLogHeader() { + introStr := fmt.Sprintf( + gui.Tr.CommandLogHeader, + gui.getKeyDisplay(gui.Config.GetUserConfig().Keybinding.Universal.ExtrasMenu), + ) + fmt.Fprintln(gui.Views.Extras, utils.ColoredString(introStr, color.FgCyan)) +} + // layout is called for every screen re-render e.g. when the screen is resized func (gui *Gui) layout(g *gocui.Gui) error { if !gui.ViewsSetup { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index ecb44952c..b49459096 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -448,6 +448,7 @@ type TranslationSet struct { CommandLog string ToggleShowCommandLog string FocusCommandLog string + CommandLogHeader string Spans Spans } @@ -1187,6 +1188,7 @@ func englishTranslationSet() TranslationSet { CommandLog: "Command Log", ToggleShowCommandLog: "Toggle show/hide command log", FocusCommandLog: "Focus command log", + CommandLogHeader: "You can hide/focus this panel by pressing '%s' or hide it permanently in your config with `gui.showCommandLog: false`\n", Spans: Spans{ // TODO: combine this with the original keybinding descriptions (those are all in lowercase atm) CheckoutCommit: "Checkout commit",