diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 74ee14b06..26c3c5618 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -115,10 +115,7 @@ func (gui *Gui) getSelectedBranch(v *gocui.View) commands.Branch { } func (gui *Gui) renderBranchesOptions(g *gocui.Gui) error { - return gui.renderOptionsMap(g, map[string]string{ - "← → ↑ ↓": gui.Tr.SLocalize("navigate"), - "?": gui.Tr.SLocalize("help"), - }) + return gui.renderGlobalOptions(g) } // may want to standardise how these select methods work diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 9e8eb681a..06b8490a9 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -59,10 +59,7 @@ func (gui *Gui) handleResetToCommit(g *gocui.Gui, commitView *gocui.View) error } func (gui *Gui) renderCommitsOptions(g *gocui.Gui) error { - return gui.renderOptionsMap(g, map[string]string{ - "← → ↑ ↓": gui.Tr.SLocalize("navigate"), - "?": gui.Tr.SLocalize("help"), - }) + return gui.renderGlobalOptions(g) } func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error { diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 43a88c6d2..52366304b 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -172,22 +172,7 @@ func (gui *Gui) handleIgnoreFile(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) renderfilesOptions(g *gocui.Gui, file *commands.File) error { - optionsMap := map[string]string{ - "PgUp/PgDn": gui.Tr.SLocalize("scroll"), - "← → ↑ ↓": gui.Tr.SLocalize("navigate"), - "?": gui.Tr.SLocalize("help"), - } - if gui.State.HasMergeConflicts { - optionsMap["a"] = gui.Tr.SLocalize("abortMerge") - optionsMap["m"] = gui.Tr.SLocalize("resolveMergeConflicts") - } - if file == nil { - return gui.renderOptionsMap(g, optionsMap) - } - if file.Tracked { - optionsMap["d"] = gui.Tr.SLocalize("checkout") - } - return gui.renderOptionsMap(g, optionsMap) + return gui.renderGlobalOptions(g) } func (gui *Gui) handleFileSelect(g *gocui.Gui, v *gocui.View) error { diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 74cfd06a6..bd5d5fd2c 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -348,6 +348,18 @@ func (gui *Gui) renderAppStatus(g *gocui.Gui) error { return nil } +func (gui *Gui) renderGlobalOptions(g *gocui.Gui) error { + return gui.renderOptionsMap(g, map[string]string{ + "R": gui.Tr.SLocalize("refresh"), + "p": gui.Tr.SLocalize("pull"), + "P": gui.Tr.SLocalize("push"), + "PgUp/PgDn": gui.Tr.SLocalize("scroll"), + "← → ↑ ↓": gui.Tr.SLocalize("navigate"), + "esc/q": gui.Tr.SLocalize("close"), + "?": gui.Tr.SLocalize("help"), + }) +} + func (gui *Gui) goEvery(g *gocui.Gui, interval time.Duration, function func(*gocui.Gui) error) { go func() { for range time.Tick(interval) { diff --git a/pkg/gui/stash_panel.go b/pkg/gui/stash_panel.go index 33f42e5f6..9ca07717b 100644 --- a/pkg/gui/stash_panel.go +++ b/pkg/gui/stash_panel.go @@ -33,10 +33,7 @@ func (gui *Gui) getSelectedStashEntry(v *gocui.View) *commands.StashEntry { } func (gui *Gui) renderStashOptions(g *gocui.Gui) error { - return gui.renderOptionsMap(g, map[string]string{ - "← → ↑ ↓": gui.Tr.SLocalize("navigate"), - "?": gui.Tr.SLocalize("help"), - }) + return gui.renderGlobalOptions(g) } func (gui *Gui) handleStashEntrySelect(g *gocui.Gui, v *gocui.View) error { diff --git a/pkg/gui/status_panel.go b/pkg/gui/status_panel.go index 96eb2d52e..6948e9678 100644 --- a/pkg/gui/status_panel.go +++ b/pkg/gui/status_panel.go @@ -42,9 +42,7 @@ func (gui *Gui) refreshStatus(g *gocui.Gui) error { } func (gui *Gui) renderStatusOptions(g *gocui.Gui) error { - return gui.renderOptionsMap(g, map[string]string{ - "?": gui.Tr.SLocalize("help"), - }) + return gui.renderGlobalOptions(g) } func (gui *Gui) handleCheckForUpdate(g *gocui.Gui, v *gocui.View) error { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 8b0d266f3..5dcb9d544 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -78,6 +78,12 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "refresh", Other: "refresh", + }, &i18n.Message{ + ID: "push", + Other: "push", + }, &i18n.Message{ + ID: "pull", + Other: "pull", }, &i18n.Message{ ID: "addPatch", Other: "add patch",