1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-27 00:51:18 +02:00

stateless undos and redos

This commit is contained in:
Jesse Duffield
2020-03-21 19:07:52 +11:00
parent 094939451d
commit c3aefdb98e
3 changed files with 66 additions and 110 deletions

View File

@ -144,13 +144,11 @@ func (gui *Gui) handleForceCheckout(g *gocui.Gui, v *gocui.View) error {
}
type handleCheckoutRefOptions struct {
OnDone func()
WaitingStatus string
EnvVars []string
}
func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions) error {
onDone := options.OnDone
waitingStatus := options.WaitingStatus
if waitingStatus == "" {
waitingStatus = gui.Tr.SLocalize("CheckingOutStatus")
@ -172,9 +170,6 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions)
if err := gui.GitCommand.Checkout(ref, cmdOptions); err != nil {
return gui.createErrorPanel(g, err.Error())
}
if onDone != nil {
onDone()
}
// checkout successful so we select the new branch
gui.State.Panels.Branches.SelectedLine = 0
@ -194,10 +189,6 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions)
}
}
if onDone != nil {
onDone()
}
gui.State.Panels.Branches.SelectedLine = 0
gui.State.Panels.Commits.SelectedLine = 0
return gui.refreshSidePanels(gui.g)