@@ -53,7 +53,7 @@ func (self *ContextMgr) Replace(c types.Context) error {
5353
5454 defer self .Unlock ()
5555
56- return self .ActivateContext (c , types.OnFocusOpts {})
56+ return self .Activate (c , types.OnFocusOpts {})
5757}
5858
5959func (self * ContextMgr ) Push (c types.Context , opts ... types.OnFocusOpts ) error {
@@ -74,7 +74,7 @@ func (self *ContextMgr) Push(c types.Context, opts ...types.OnFocusOpts) error {
7474 contextsToDeactivate , contextToActivate := self .pushToContextStack (c )
7575
7676 for _ , contextToDeactivate := range contextsToDeactivate {
77- if err := self .deactivateContext (contextToDeactivate , types.OnFocusLostOpts {NewContextKey : c .GetKey ()}); err != nil {
77+ if err := self .deactivate (contextToDeactivate , types.OnFocusLostOpts {NewContextKey : c .GetKey ()}); err != nil {
7878 return err
7979 }
8080 }
@@ -83,7 +83,7 @@ func (self *ContextMgr) Push(c types.Context, opts ...types.OnFocusOpts) error {
8383 return nil
8484 }
8585
86- return self .ActivateContext (contextToActivate , singleOpts )
86+ return self .Activate (contextToActivate , singleOpts )
8787}
8888
8989// Adjusts the context stack based on the context that's being pushed and
@@ -160,44 +160,14 @@ func (self *ContextMgr) Pop() error {
160160
161161 self .Unlock ()
162162
163- if err := self .deactivateContext (currentContext , types.OnFocusLostOpts {NewContextKey : newContext .GetKey ()}); err != nil {
163+ if err := self .deactivate (currentContext , types.OnFocusLostOpts {NewContextKey : newContext .GetKey ()}); err != nil {
164164 return err
165165 }
166166
167- return self .ActivateContext (newContext , types.OnFocusOpts {})
167+ return self .Activate (newContext , types.OnFocusOpts {})
168168}
169169
170- func (self * ContextMgr ) RemoveContexts (contextsToRemove []types.Context ) error {
171- self .Lock ()
172-
173- if len (self .ContextStack ) == 1 {
174- self .Unlock ()
175- return nil
176- }
177-
178- rest := lo .Filter (self .ContextStack , func (context types.Context , _ int ) bool {
179- for _ , contextToRemove := range contextsToRemove {
180- if context .GetKey () == contextToRemove .GetKey () {
181- return false
182- }
183- }
184- return true
185- })
186- self .ContextStack = rest
187- contextToActivate := rest [len (rest )- 1 ]
188- self .Unlock ()
189-
190- for _ , context := range contextsToRemove {
191- if err := self .deactivateContext (context , types.OnFocusLostOpts {NewContextKey : contextToActivate .GetKey ()}); err != nil {
192- return err
193- }
194- }
195-
196- // activate the item at the top of the stack
197- return self .ActivateContext (contextToActivate , types.OnFocusOpts {})
198- }
199-
200- func (self * ContextMgr ) deactivateContext (c types.Context , opts types.OnFocusLostOpts ) error {
170+ func (self * ContextMgr ) deactivate (c types.Context , opts types.OnFocusLostOpts ) error {
201171 view , _ := self .gui .c .GocuiGui ().View (c .GetViewName ())
202172
203173 if opts .NewContextKey != context .SEARCH_CONTEXT_KEY {
@@ -220,7 +190,7 @@ func (self *ContextMgr) deactivateContext(c types.Context, opts types.OnFocusLos
220190 return nil
221191}
222192
223- func (self * ContextMgr ) ActivateContext (c types.Context , opts types.OnFocusOpts ) error {
193+ func (self * ContextMgr ) Activate (c types.Context , opts types.OnFocusOpts ) error {
224194 viewName := c .GetViewName ()
225195 v , err := self .gui .c .GocuiGui ().View (viewName )
226196 if err != nil {
@@ -392,7 +362,7 @@ func (self *ContextMgr) ContextForKey(key types.ContextKey) types.Context {
392362 return nil
393363}
394364
395- func (self * ContextMgr ) PopupContexts () []types.Context {
365+ func (self * ContextMgr ) CurrentPopup () []types.Context {
396366 self .RLock ()
397367 defer self .RUnlock ()
398368
0 commit comments