Skip to content

Commit a3e4d19

Browse files
committed
Cleanup: pass target context to focusMainView directly
It's a bit silly to pass a window name and then call a function to get the corresponding context, when we can simply pass the context directly.
1 parent d95120d commit a3e4d19

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/gui/controllers/switch_to_focused_main_view_controller.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,18 @@ func (self *SwitchToFocusedMainViewController) Context() types.Context {
6060
}
6161

6262
func (self *SwitchToFocusedMainViewController) onClickMain(opts gocui.ViewMouseBindingOpts) error {
63-
return self.focusMainView("main")
63+
return self.focusMainView(self.c.Contexts().Normal)
6464
}
6565

6666
func (self *SwitchToFocusedMainViewController) onClickSecondary(opts gocui.ViewMouseBindingOpts) error {
67-
return self.focusMainView("secondary")
67+
return self.focusMainView(self.c.Contexts().NormalSecondary)
6868
}
6969

7070
func (self *SwitchToFocusedMainViewController) handleFocusMainView() error {
71-
return self.focusMainView("main")
71+
return self.focusMainView(self.c.Contexts().Normal)
7272
}
7373

74-
func (self *SwitchToFocusedMainViewController) focusMainView(mainViewName string) error {
75-
mainViewContext := self.c.Helpers().Window.GetContextForWindow(mainViewName)
74+
func (self *SwitchToFocusedMainViewController) focusMainView(mainViewContext types.Context) error {
7675
mainViewContext.SetParentContext(self.context)
7776
if context, ok := mainViewContext.(types.ISearchableContext); ok {
7877
context.ClearSearchString()

0 commit comments

Comments
 (0)