Skip to content

Commit

Permalink
Fixed comments from jesseduffield on issue jesseduffield#137
Browse files Browse the repository at this point in the history
  • Loading branch information
mjarkk committed Aug 16, 2018
1 parent 88e1a81 commit 9074650
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/gui/branches_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
)
Expand All @@ -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,
},
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/gui/commit_message_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/gui/confirmation_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
)
Expand Down Expand Up @@ -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",
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/gui/files_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9074650

Please sign in to comment.