mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-04 03:48:07 +02:00
add renderGlobalOptions
render only global options for all panels
This commit is contained in:
parent
97ad4a1643
commit
e21f739f4f
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user