1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/gui/controllers/search_controller.go
Jesse Duffield a9e2c8129f Introduce filtered list view model
We're going to start supporting filtering of list views
2023-07-03 12:54:13 +10:00

49 lines
1.1 KiB
Go

package controllers
import (
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
type SearchControllerFactory struct {
c *ControllerCommon
}
func NewSearchControllerFactory(c *ControllerCommon) *SearchControllerFactory {
return &SearchControllerFactory{
c: c,
}
}
func (self *SearchControllerFactory) Create(context types.ISearchableContext) *SearchController {
return &SearchController{
baseController: baseController{},
c: self.c,
context: context,
}
}
type SearchController struct {
baseController
c *ControllerCommon
context types.ISearchableContext
}
func (self *SearchController) Context() types.Context {
return self.context
}
func (self *SearchController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.StartSearch),
Handler: self.OpenSearchPrompt,
Description: self.c.Tr.StartSearch,
},
}
}
func (self *SearchController) OpenSearchPrompt() error {
return self.c.Helpers().Search.OpenSearchPrompt(self.context)
}