1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-18 05:17:55 +02:00

print header for command log

This commit is contained in:
Jesse Duffield 2021-04-11 21:42:18 +10:00
parent adee0b8ccb
commit e4f0a470e9
2 changed files with 15 additions and 0 deletions

View File

@ -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 {

View File

@ -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",