diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-23 14:40:28 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | a2318d75b5a81aba6f79ffbd76c8a602121ac20c (patch) | |
tree | 4288c9265a2ed3d70761f3295783a53d718c5230 /pkg/gui/ref_helper.go | |
parent | 1dd7307fde033dae5fececac15810a99e26c3d91 (diff) |
fix some things
Diffstat (limited to 'pkg/gui/ref_helper.go')
-rw-r--r-- | pkg/gui/ref_helper.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/pkg/gui/ref_helper.go b/pkg/gui/ref_helper.go index c8cccb74a..a6f930c96 100644 --- a/pkg/gui/ref_helper.go +++ b/pkg/gui/ref_helper.go @@ -16,18 +16,18 @@ type RefHelper struct { c *controllers.ControllerCommon git *commands.GitCommand - State *GuiRepoState + getState func() *GuiRepoState } func NewRefHelper( c *controllers.ControllerCommon, git *commands.GitCommand, - state *GuiRepoState, + getState func() *GuiRepoState, ) *RefHelper { return &RefHelper{ - c: c, - git: git, - State: state, + c: c, + git: git, + getState: getState, } } @@ -42,10 +42,10 @@ func (self *RefHelper) CheckoutRef(ref string, options types.CheckoutRefOptions) cmdOptions := git_commands.CheckoutOptions{Force: false, EnvVars: options.EnvVars} onSuccess := func() { - self.State.Panels.Branches.SelectedLineIdx = 0 - self.State.Panels.Commits.SelectedLineIdx = 0 + self.getState().Panels.Branches.SelectedLineIdx = 0 + self.getState().Panels.Commits.SelectedLineIdx = 0 // loading a heap of commits is slow so we limit them whenever doing a reset - self.State.Panels.Commits.LimitCommits = true + self.getState().Panels.Commits.LimitCommits = true } return self.c.WithWaitingStatus(waitingStatus, func() error { @@ -97,12 +97,12 @@ func (self *RefHelper) ResetToRef(ref string, strength string, envVars []string) return self.c.Error(err) } - self.State.Panels.Commits.SelectedLineIdx = 0 - self.State.Panels.ReflogCommits.SelectedLineIdx = 0 + self.getState().Panels.Commits.SelectedLineIdx = 0 + self.getState().Panels.ReflogCommits.SelectedLineIdx = 0 // loading a heap of commits is slow so we limit them whenever doing a reset - self.State.Panels.Commits.LimitCommits = true + self.getState().Panels.Commits.LimitCommits = true - if err := self.c.PushContext(self.State.Contexts.BranchCommits); err != nil { + if err := self.c.PushContext(self.getState().Contexts.BranchCommits); err != nil { return err } |