From 557009e660e3203dce62624599c173e25f086465 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Wed, 5 Sep 2018 11:12:11 +0200 Subject: [PATCH] help -> menu --- pkg/gui/gui.go | 2 +- pkg/gui/keybindings.go | 16 +++++++------- pkg/gui/{help_panel.go => menu_panel.go} | 28 ++++++++++++------------ pkg/gui/view_helpers.go | 4 ++-- pkg/i18n/dutch.go | 4 ++-- pkg/i18n/english.go | 4 ++-- pkg/i18n/polish.go | 2 +- scripts/generate_cheatsheet.go | 2 +- 8 files changed, 31 insertions(+), 31 deletions(-) rename pkg/gui/{help_panel.go => menu_panel.go} (74%) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index bd5d5fd2c..c9beb36eb 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -356,7 +356,7 @@ func (gui *Gui) renderGlobalOptions(g *gocui.Gui) error { "PgUp/PgDn": gui.Tr.SLocalize("scroll"), "← → ↑ ↓": gui.Tr.SLocalize("navigate"), "esc/q": gui.Tr.SLocalize("close"), - "?": gui.Tr.SLocalize("help"), + "?": gui.Tr.SLocalize("menu"), }) } diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 29caa9a26..0ca82d3c6 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -70,7 +70,7 @@ func (gui *Gui) GetKeybindings() []Binding { ViewName: "", Key: '?', Modifier: gocui.ModNone, - Handler: gui.handleHelp, + Handler: gui.handleMenu, }, { ViewName: "status", Key: 'e', @@ -342,26 +342,26 @@ func (gui *Gui) GetKeybindings() []Binding { Modifier: gocui.ModNone, Handler: gui.handleNewlineCommitMessage, }, { - ViewName: "help", + ViewName: "menu", Key: gocui.KeyEsc, Modifier: gocui.ModNone, - Handler: gui.handleHelpClose, + Handler: gui.handleMenuClose, }, { - ViewName: "help", + ViewName: "menu", Key: 'q', Modifier: gocui.ModNone, - Handler: gui.handleHelpClose, + Handler: gui.handleMenuClose, }, { - ViewName: "help", + ViewName: "menu", Key: gocui.KeySpace, Modifier: gocui.ModNone, - Handler: gui.handleHelpPress, + Handler: gui.handleMenuPress, }, } // Would make these keybindings global but that interferes with editing // input in the confirmation panel - for _, viewName := range []string{"status", "files", "branches", "commits", "stash", "help"} { + for _, viewName := range []string{"status", "files", "branches", "commits", "stash", "menu"} { bindings = append(bindings, []Binding{ {ViewName: viewName, Key: gocui.KeyTab, Modifier: gocui.ModNone, Handler: gui.nextView}, {ViewName: viewName, Key: gocui.KeyArrowLeft, Modifier: gocui.ModNone, Handler: gui.previousView}, diff --git a/pkg/gui/help_panel.go b/pkg/gui/menu_panel.go similarity index 74% rename from pkg/gui/help_panel.go rename to pkg/gui/menu_panel.go index 2bc8dcb41..fa276e8c4 100644 --- a/pkg/gui/help_panel.go +++ b/pkg/gui/menu_panel.go @@ -8,10 +8,10 @@ import ( "github.com/jesseduffield/lazygit/pkg/utils" ) -func (gui *Gui) handleHelpPress(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleMenuPress(g *gocui.Gui, v *gocui.View) error { lineNumber := gui.getItemPosition(v) if len(gui.State.Keys) > lineNumber { - err := gui.handleHelpClose(g, v) + err := gui.handleMenuClose(g, v) if err != nil { return err } @@ -20,13 +20,13 @@ func (gui *Gui) handleHelpPress(g *gocui.Gui, v *gocui.View) error { return nil } -func (gui *Gui) handleHelpSelect(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleMenuSelect(g *gocui.Gui, v *gocui.View) error { // doing nothing for now // but it is needed for switch in newLineFocused return nil } -func (gui *Gui) renderHelpOptions(g *gocui.Gui) error { +func (gui *Gui) renderMenuOptions(g *gocui.Gui) error { optionsMap := map[string]string{ "esc/q": gui.Tr.SLocalize("close"), "↑ ↓": gui.Tr.SLocalize("navigate"), @@ -35,11 +35,11 @@ func (gui *Gui) renderHelpOptions(g *gocui.Gui) error { return gui.renderOptionsMap(g, optionsMap) } -func (gui *Gui) handleHelpClose(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleMenuClose(g *gocui.Gui, v *gocui.View) error { // better to delete because for example after closing update confirmation panel, // the focus isn't set back to any of panels and one is unable to even quit //_, err := g.SetViewOnBottom(v.Name()) - err := g.DeleteView("help") + err := g.DeleteView("menu") if err != nil { return err } @@ -70,7 +70,7 @@ func (gui *Gui) getMaxKeyLength(bindings []Binding) int { return max } -func (gui *Gui) handleHelp(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleMenu(g *gocui.Gui, v *gocui.View) error { // clear keys slice, so we don't have ghost elements gui.State.Keys = gui.State.Keys[:0] content := "" @@ -86,22 +86,22 @@ func (gui *Gui) handleHelp(g *gocui.Gui, v *gocui.View) error { // y1-1 so there will not be an extra space at the end of panel x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(g, content) - helpView, _ := g.SetView("help", x0, y0, x1, y1-1, 0) - helpView.Title = strings.Title(gui.Tr.SLocalize("help")) - helpView.FgColor = gocui.ColorWhite + menuView, _ := g.SetView("menu", x0, y0, x1, y1-1, 0) + menuView.Title = strings.Title(gui.Tr.SLocalize("menu")) + menuView.FgColor = gocui.ColorWhite - if err := gui.renderHelpOptions(g); err != nil { + if err := gui.renderMenuOptions(g); err != nil { return err } - fmt.Fprint(helpView, content) + fmt.Fprint(menuView, content) g.Update(func(g *gocui.Gui) error { - _, err := g.SetViewOnTop("help") + _, err := g.SetViewOnTop("menu") if err != nil { return err } - return gui.switchFocus(g, v, helpView) + return gui.switchFocus(g, v, menuView) }) return nil } diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 5f2630204..88b74d12e 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -82,8 +82,8 @@ func (gui *Gui) newLineFocused(g *gocui.Gui, v *gocui.View) error { mainView.SetOrigin(0, 0) switch v.Name() { - case "help": - return gui.handleHelpSelect(g, v) + case "menu": + return gui.handleMenuSelect(g, v) case "status": return gui.handleStatusSelect(g, v) case "files": diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index daaa47fd1..cbdccbf2a 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -44,8 +44,8 @@ func addDutch(i18nObject *i18n.Bundle) error { ID: "navigate", Other: "navigeer", }, &i18n.Message{ - ID: "help", - Other: "help", + ID: "menu", + Other: "menu", }, &i18n.Message{ ID: "execute", Other: "execute", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 5dcb9d544..471a75b6f 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -52,8 +52,8 @@ func addEnglish(i18nObject *i18n.Bundle) error { ID: "navigate", Other: "navigate", }, &i18n.Message{ - ID: "help", - Other: "help", + ID: "menu", + Other: "menu", }, &i18n.Message{ ID: "execute", Other: "execute", diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index 795c3b4fa..f99890c15 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -42,7 +42,7 @@ func addPolish(i18nObject *i18n.Bundle) error { ID: "navigate", Other: "nawiguj", }, &i18n.Message{ - ID: "help", + ID: "menu", Other: "pomoc", }, &i18n.Message{ ID: "execute", diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index 434f56bdd..2c18e5f03 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -24,7 +24,7 @@ func main() { current := "" content := "" - file.WriteString("# Lazygit " + a.Tr.SLocalize("help")) + file.WriteString("# Lazygit " + a.Tr.SLocalize("menu")) for _, binding := range bindings { if key := a.Gui.GetKey(binding); key != "" && binding.Description != "" {