1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-17 01:42:45 +02:00

Replace IsCurrentContext() with Context().IsCurrent()

This commit is contained in:
Stefan Haller
2024-08-08 10:37:05 +02:00
parent f30387e7f5
commit 94d6f4dae7
4 changed files with 2 additions and 8 deletions

View File

@ -53,7 +53,7 @@ func NewPatchExplorerContext(
func(selectedLineIdx int) error { func(selectedLineIdx int) error {
ctx.GetMutex().Lock() ctx.GetMutex().Lock()
defer ctx.GetMutex().Unlock() defer ctx.GetMutex().Unlock()
return ctx.NavigateTo(ctx.c.IsCurrentContext(ctx), selectedLineIdx) return ctx.NavigateTo(ctx.c.Context().IsCurrent(ctx), selectedLineIdx)
}), }),
) )

View File

@ -61,7 +61,7 @@ func (self *MergeConflictsHelper) EscapeMerge() error {
// to continue the merge/rebase. In that case, we don't want to then push the // to continue the merge/rebase. In that case, we don't want to then push the
// files context over it. // files context over it.
// So long as both places call OnUIThread, we're fine. // So long as both places call OnUIThread, we're fine.
if self.c.IsCurrentContext(self.c.Contexts().MergeConflicts) { if self.c.Context().IsCurrent(self.c.Contexts().MergeConflicts) {
return self.c.Context().Push(self.c.Contexts().Files) return self.c.Context().Push(self.c.Contexts().Files)
} }
return nil return nil

View File

@ -45,10 +45,6 @@ func (self *guiCommon) RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error) {
return self.gui.runSubprocessWithSuspense(cmdObj) return self.gui.runSubprocessWithSuspense(cmdObj)
} }
func (self *guiCommon) IsCurrentContext(c types.Context) bool {
return self.gui.State.ContextMgr.IsCurrent(c)
}
func (self *guiCommon) Context() types.IContextMgr { func (self *guiCommon) Context() types.IContextMgr {
return self.gui.State.ContextMgr return self.gui.State.ContextMgr
} }

View File

@ -57,8 +57,6 @@ type IGuiCommon interface {
RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error) RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error)
RunSubprocessAndRefresh(oscommands.ICmdObj) error RunSubprocessAndRefresh(oscommands.ICmdObj) error
IsCurrentContext(Context) bool
// TODO: replace the above context-based methods with just using Context() e.g. replace PushContext() with Context().Push()
Context() IContextMgr Context() IContextMgr
ContextForKey(key ContextKey) Context ContextForKey(key ContextKey) Context