mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-10 22:42:00 +02:00
Remove unused method RemoveContexts()
This commit is contained in:
@@ -167,36 +167,6 @@ func (self *ContextMgr) Pop() error {
|
|||||||
return self.ActivateContext(newContext, types.OnFocusOpts{})
|
return self.ActivateContext(newContext, types.OnFocusOpts{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *ContextMgr) RemoveContexts(contextsToRemove []types.Context) error {
|
|
||||||
self.Lock()
|
|
||||||
|
|
||||||
if len(self.ContextStack) == 1 {
|
|
||||||
self.Unlock()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
rest := lo.Filter(self.ContextStack, func(context types.Context, _ int) bool {
|
|
||||||
for _, contextToRemove := range contextsToRemove {
|
|
||||||
if context.GetKey() == contextToRemove.GetKey() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
self.ContextStack = rest
|
|
||||||
contextToActivate := rest[len(rest)-1]
|
|
||||||
self.Unlock()
|
|
||||||
|
|
||||||
for _, context := range contextsToRemove {
|
|
||||||
if err := self.deactivateContext(context, types.OnFocusLostOpts{NewContextKey: contextToActivate.GetKey()}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// activate the item at the top of the stack
|
|
||||||
return self.ActivateContext(contextToActivate, types.OnFocusOpts{})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *ContextMgr) deactivateContext(c types.Context, opts types.OnFocusLostOpts) error {
|
func (self *ContextMgr) deactivateContext(c types.Context, opts types.OnFocusLostOpts) error {
|
||||||
view, _ := self.gui.c.GocuiGui().View(c.GetViewName())
|
view, _ := self.gui.c.GocuiGui().View(c.GetViewName())
|
||||||
|
|
||||||
|
@@ -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) RemoveContexts(contexts []types.Context) error {
|
|
||||||
return self.gui.State.ContextMgr.RemoveContexts(contexts)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *guiCommon) CurrentContext() types.Context {
|
func (self *guiCommon) CurrentContext() types.Context {
|
||||||
return self.gui.State.ContextMgr.Current()
|
return self.gui.State.ContextMgr.Current()
|
||||||
}
|
}
|
||||||
|
@@ -57,10 +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
|
||||||
|
|
||||||
// Removes all given contexts from the stack. If a given context is not in the stack, it is ignored.
|
|
||||||
// This is for when you have a group of contexts that are bundled together e.g. with the commit message panel.
|
|
||||||
// If you want to remove a single context, you should probably use PopContext instead.
|
|
||||||
RemoveContexts([]Context) error
|
|
||||||
CurrentContext() Context
|
CurrentContext() Context
|
||||||
CurrentStaticContext() Context
|
CurrentStaticContext() Context
|
||||||
CurrentSideContext() Context
|
CurrentSideContext() Context
|
||||||
|
Reference in New Issue
Block a user