diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-27 21:20:45 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-28 11:59:45 +1100 |
commit | 384c2e13d7f215aef7c9307f6214c4a1740b9f10 (patch) | |
tree | cbad81e96e74396eaa4287c72971ae61fc8a41c9 /pkg/gui/stash_panel.go | |
parent | 198d237679bcc19655138f76a11770c3ef91ec4f (diff) |
better refreshing for stash
Diffstat (limited to 'pkg/gui/stash_panel.go')
-rw-r--r-- | pkg/gui/stash_panel.go | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/pkg/gui/stash_panel.go b/pkg/gui/stash_panel.go index 62d138fb4..cd41b4909 100644 --- a/pkg/gui/stash_panel.go +++ b/pkg/gui/stash_panel.go @@ -47,22 +47,16 @@ func (gui *Gui) handleStashEntrySelect(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) refreshStashEntries(g *gocui.Gui) error { - g.Update(func(g *gocui.Gui) error { - gui.State.StashEntries = gui.GitCommand.GetStashEntries() + gui.State.StashEntries = gui.GitCommand.GetStashEntries() - gui.refreshSelectedLine(&gui.State.Panels.Stash.SelectedLine, len(gui.State.StashEntries)) + gui.refreshSelectedLine(&gui.State.Panels.Stash.SelectedLine, len(gui.State.StashEntries)) - stashView := gui.getStashView() + stashView := gui.getStashView() - displayStrings := presentation.GetStashEntryListDisplayStrings(gui.State.StashEntries) - gui.renderDisplayStrings(stashView, displayStrings) + displayStrings := presentation.GetStashEntryListDisplayStrings(gui.State.StashEntries) + gui.renderDisplayStrings(stashView, displayStrings) - if err := gui.resetOrigin(stashView); err != nil { - return err - } - return nil - }) - return nil + return gui.resetOrigin(stashView) } // specific functions @@ -97,10 +91,7 @@ func (gui *Gui) stashDo(g *gocui.Gui, v *gocui.View, method string) error { if err := gui.GitCommand.StashDo(stashEntry.Index, method); err != nil { return gui.createErrorPanel(g, err.Error()) } - if err := gui.refreshStashEntries(g); err != nil { - return gui.createErrorPanel(g, err.Error()) - } - return gui.refreshFiles() + return gui.refreshSidePanels(refreshOptions{scope: []int{STASH, FILES}}) } func (gui *Gui) handleStashSave(stashFunc func(message string) error) error { @@ -111,10 +102,7 @@ func (gui *Gui) handleStashSave(stashFunc func(message string) error) error { if err := stashFunc(gui.trimmedContent(v)); err != nil { return gui.createErrorPanel(g, err.Error()) } - if err := gui.refreshStashEntries(g); err != nil { - return gui.createErrorPanel(g, err.Error()) - } - return gui.refreshFiles() + return gui.refreshSidePanels(refreshOptions{scope: []int{STASH, FILES}}) }) } |