From 77faf85cfc749458aeafe45cb7df88e0a9d00500 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 11 Feb 2019 21:07:12 +1100 Subject: [PATCH] post-merge cleanup --- pkg/gui/confirmation_panel.go | 2 +- pkg/gui/credentials_panel.go | 8 ++++---- pkg/gui/files_panel.go | 4 ++-- pkg/gui/gui.go | 12 ++++++------ pkg/gui/keybindings.go | 1 - 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index b2a202ddd..212565895 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -89,7 +89,7 @@ func (gui *Gui) prepareConfirmationPanel(currentView *gocui.View, title, prompt } func (gui *Gui) onNewPopupPanel() { - viewNames = []string{"commitMessage", + viewNames := []string{"commitMessage", "credentials", "menu"} for _, viewName := range viewNames { diff --git a/pkg/gui/credentials_panel.go b/pkg/gui/credentials_panel.go index bc894c422..a609b3eee 100644 --- a/pkg/gui/credentials_panel.go +++ b/pkg/gui/credentials_panel.go @@ -36,7 +36,7 @@ func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUn func (gui *Gui) handleSubmitCredential(g *gocui.Gui, v *gocui.View) error { message := gui.trimmedContent(v) gui.credentials <- message - err := gui.refreshFiles(g) + err := gui.refreshFiles() if err != nil { return err } @@ -51,7 +51,7 @@ func (gui *Gui) handleSubmitCredential(g *gocui.Gui, v *gocui.View) error { } nextView, err := gui.g.View("confirmation") if err != nil { - nextView = gui.getFilesView(g) + nextView = gui.getFilesView() } err = gui.switchFocus(g, nil, nextView) if err != nil { @@ -67,7 +67,7 @@ func (gui *Gui) handleCloseCredentialsView(g *gocui.Gui, v *gocui.View) error { } gui.credentials <- "" - return gui.switchFocus(g, nil, gui.getFilesView(g)) + return gui.switchFocus(g, nil, gui.getFilesView()) } func (gui *Gui) handleCredentialsViewFocused(g *gocui.Gui, v *gocui.View) error { @@ -96,7 +96,7 @@ func (gui *Gui) HandleCredentialsPopup(g *gocui.Gui, popupOpened bool, cmdErr er errMessage = gui.Tr.SLocalize("PassUnameWrong") } // we are not logging this error because it may contain a password - _ = gui.createSpecificErrorPanel(errMessage, gui.getFilesView(gui.g), false) + _ = gui.createSpecificErrorPanel(errMessage, gui.getFilesView(), false) } else { _ = gui.closeConfirmationPrompt(g) _ = gui.refreshSidePanels(g) diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 915ff45c3..1768451fe 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -50,7 +50,7 @@ func (gui *Gui) handleFileSelect(g *gocui.Gui, v *gocui.View, alreadySelected bo content := gui.GitCommand.Diff(file, false) if alreadySelected { g.Update(func(*gocui.Gui) error { - return gui.setViewContent(gui.g, gui.getMainView(gui.g), content) + return gui.setViewContent(gui.g, gui.getMainView(), content) }) return nil } @@ -200,7 +200,7 @@ func (gui *Gui) handleStageAll(g *gocui.Gui, v *gocui.View) error { return err } - return gui.handleFileSelect(g, v) + return gui.handleFileSelect(g, v, false) } func (gui *Gui) handleAddPatch(g *gocui.Gui, v *gocui.View) error { diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index c33718937..28ecdaebe 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -475,7 +475,7 @@ func (gui *Gui) fetch(g *gocui.Gui, v *gocui.View, canAskForCredentials bool) (u return unamePassOpend, err } -func (gui *Gui) updateLoader(g *gocui.Gui) error { +func (gui *Gui) updateLoader() error { gui.g.Update(func(g *gocui.Gui) error { if view, _ := g.View("confirmation"); view != nil { content := gui.trimmedContent(view) @@ -547,15 +547,15 @@ func (gui *Gui) Run() error { if err != nil && strings.Contains(err.Error(), "exit status 128") && isNew { _ = gui.createConfirmationPanel(g, g.CurrentView(), gui.Tr.SLocalize("NoAutomaticGitFetchTitle"), gui.Tr.SLocalize("NoAutomaticGitFetchBody"), nil, nil) } else { - gui.goEvery(g, time.Second*60, func(g *gocui.Gui) error { - _, err := gui.fetch(g, g.CurrentView(), false) + gui.goEvery(time.Second*60, func() error { + _, err := gui.fetch(gui.g, gui.g.CurrentView(), false) return err }) } }() - gui.goEvery(g, time.Second*10, gui.refreshFiles) - gui.goEvery(g, time.Millisecond*50, gui.updateLoader) - gui.goEvery(g, time.Millisecond*50, gui.renderAppStatus) + gui.goEvery(time.Second*10, gui.refreshFiles) + gui.goEvery(time.Millisecond*50, gui.updateLoader) + gui.goEvery(time.Millisecond*50, gui.renderAppStatus) g.SetManagerFunc(gui.layout) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index c31d51ae9..8ddd3aaa4 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -237,7 +237,6 @@ func (gui *Gui) GetKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.handlePickHunk, Description: gui.Tr.SLocalize("PickHunk"), - KeyReadable: "space", }, { ViewName: "merging", Key: 'b',