1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00

better refreshing for stash

This commit is contained in:
Jesse Duffield 2020-03-27 21:20:45 +11:00
parent 198d237679
commit 384c2e13d7

View File

@ -47,7 +47,6 @@ 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.refreshSelectedLine(&gui.State.Panels.Stash.SelectedLine, len(gui.State.StashEntries))
@ -57,12 +56,7 @@ func (gui *Gui) refreshStashEntries(g *gocui.Gui) error {
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}})
})
}