mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
Remove unused method RemoveContexts()
This commit is contained in:
parent
111d10fe5c
commit
8e15451117
3 changed files with 0 additions and 38 deletions
|
@ -167,36 +167,6 @@ func (self *ContextMgr) Pop() error {
|
|||
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 {
|
||||
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)
|
||||
}
|
||||
|
||||
func (self *guiCommon) RemoveContexts(contexts []types.Context) error {
|
||||
return self.gui.State.ContextMgr.RemoveContexts(contexts)
|
||||
}
|
||||
|
||||
func (self *guiCommon) CurrentContext() types.Context {
|
||||
return self.gui.State.ContextMgr.Current()
|
||||
}
|
||||
|
|
|
@ -57,10 +57,6 @@ type IGuiCommon interface {
|
|||
RunSubprocess(cmdObj oscommands.ICmdObj) (bool, 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
|
||||
CurrentStaticContext() Context
|
||||
CurrentSideContext() Context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue