summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kopenga <mkopenga@gmail.com>2018-08-16 11:31:03 +0200
committerMark Kopenga <mkopenga@gmail.com>2018-08-16 11:31:03 +0200
commit90746502df432ce88ed1b62e36414c2142322ff7 (patch)
tree9560430c78abdc28059caac11ec402d03875e1c1
parent88e1a815fe5c4ddf21779ca4a93f029b7b9b9239 (diff)
Fixed comments from jesseduffield on issue #137
-rw-r--r--pkg/gui/branches_panel.go4
-rw-r--r--pkg/gui/commit_message_panel.go2
-rw-r--r--pkg/gui/confirmation_panel.go4
-rw-r--r--pkg/gui/files_panel.go8
-rw-r--r--pkg/gui/gui.go3
5 files changed, 12 insertions, 9 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index 2a08eb8b1..67e0ceb07 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -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,
},
)
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go
index 697fbc024..26db703f0 100644
--- a/pkg/gui/commit_message_panel.go
+++ b/pkg/gui/commit_message_panel.go
@@ -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",
},
diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go
index aec190b7f..9c3d2b263 100644
--- a/pkg/gui/confirmation_panel.go
+++ b/pkg/gui/confirmation_panel.go
@@ -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",
},
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index 72a7d20b5..27589bc19 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -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
}
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index a6341f755..1a2ec44ba 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -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