1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

Fixed comments from jesseduffield on issue #137

This commit is contained in:
Mark Kopenga
2018-08-16 11:31:03 +02:00
parent 88e1a815fe
commit 90746502df
5 changed files with 12 additions and 9 deletions

View File

@@ -47,7 +47,7 @@ func (gui *Gui) handleNewBranch(g *gocui.Gui, v *gocui.View) error {
branch := gui.State.Branches[0]
message := gui.Tr.TemplateLocalize(
"NewBranchNameBranchOff",
map[string]interface{}{
Teml{
"branchName": branch.Name,
},
)
@@ -69,7 +69,7 @@ func (gui *Gui) handleDeleteBranch(g *gocui.Gui, v *gocui.View) error {
}
message := gui.Tr.TemplateLocalize(
"DeleteBranchMessage",
map[string]interface{}{
Teml{
"selectedBranchName": selectedBranch.Name,
},
)

View File

@@ -50,7 +50,7 @@ func (gui *Gui) handleNewlineCommitMessage(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) handleCommitFocused(g *gocui.Gui, v *gocui.View) error {
message := gui.Tr.TemplateLocalize(
"CloseConfirm",
map[string]interface{}{
Teml{
"keyBindClose": "esc",
"keyBindConfirm": "enter",
},

View File

@@ -85,7 +85,7 @@ func (gui *Gui) createConfirmationPanel(g *gocui.Gui, currentView *gocui.View, t
if err := gui.closeConfirmationPrompt(g); err != nil {
errMessage := gui.Tr.TemplateLocalize(
"CantCloseConfirmationPrompt",
map[string]interface{}{
Teml{
"error": err.Error(),
},
)
@@ -125,7 +125,7 @@ func (gui *Gui) handleNewline(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*gocui.Gui, *gocui.View) error) error {
actions := gui.Tr.TemplateLocalize(
"CloseConfirm",
map[string]interface{}{
Teml{
"keyBindClose": "esc",
"keyBindConfirm": "enter",
},

View File

@@ -90,7 +90,7 @@ func (gui *Gui) handleAddPatch(g *gocui.Gui, v *gocui.View) error {
return err
}
gui.SubProcess = sub
return nil
return gui.Errors.ErrSubProcess
}
func (gui *Gui) getSelectedFile(g *gocui.Gui) (commands.File, error) {
@@ -121,7 +121,7 @@ func (gui *Gui) handleFileRemove(g *gocui.Gui, v *gocui.View) error {
}
message := gui.Tr.TemplateLocalize(
"SureTo",
map[string]interface{}{
Teml{
"deleteVerb": deleteVerb,
"fileName": file.Name,
},
@@ -223,7 +223,7 @@ func (gui *Gui) PrepareSubProcess(g *gocui.Gui, commands ...string) error {
}
gui.SubProcess = sub
g.Update(func(g *gocui.Gui) error {
return nil
return gui.Errors.ErrSubProcess
})
return nil
}
@@ -242,7 +242,7 @@ func (gui *Gui) genericFileOpen(g *gocui.Gui, v *gocui.View, open func(string) (
}
if sub != nil {
gui.SubProcess = sub
return nil
return gui.Errors.ErrSubProcess
}
return nil
}

View File

@@ -49,6 +49,9 @@ func (gui *Gui) GenerateSentinelErrors() {
}
}
// Teml is short for template used to make the required map[string]interface{} shorter when using gui.Tr.SLocalize and gui.Tr.TemplateLocalize
type Teml map[string]interface{}
// Gui wraps the gocui Gui object which handles rendering and events
type Gui struct {
g *gocui.Gui