diff options
author | Dawid Dziurla <dawidd0811@gmail.com> | 2018-09-05 11:12:11 +0200 |
---|---|---|
committer | Dawid Dziurla <dawidd0811@gmail.com> | 2018-09-05 11:12:11 +0200 |
commit | 557009e660e3203dce62624599c173e25f086465 (patch) | |
tree | 01e3a891e8bcab6aef70c8867f6abd06683aa30c /pkg/gui | |
parent | e21f739f4fbef045c90ab44365105c2d04334a72 (diff) |
help -> menu
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/gui.go | 2 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 16 | ||||
-rw-r--r-- | pkg/gui/menu_panel.go (renamed from pkg/gui/help_panel.go) | 28 | ||||
-rw-r--r-- | pkg/gui/view_helpers.go | 4 |
4 files changed, 25 insertions, 25 deletions
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 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": |