1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
package controllers
import (
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
type SearchPromptController struct {
baseController
c *ControllerCommon
}
var _ types.IController = &SearchPromptController{}
func NewSearchPromptController(
c *ControllerCommon,
) *SearchPromptController {
return &SearchPromptController{
baseController: baseController{},
c: c,
}
}
func (self *SearchPromptController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Confirm),
Modifier: gocui.ModNone,
Handler: self.confirm,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Modifier: gocui.ModNone,
Handler: self.cancel,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Modifier: gocui.ModNone,
Handler: self.prevHistory,
},
{
Key: opts.GetKey(opts.Config.Universal.NextItem),
Modifier: gocui.ModNone,
Handler: self.nextHistory,
},
}
}
func (self *SearchPromptController) Context() types.Context {
return self.context()
}
func (self *SearchPromptController) context() types.Context {
return self.c.Contexts().Search
}
func (self *SearchPromptController) confirm() error {
return self.c.Helpers().Search.Confirm()
}
func (self *SearchPromptController) cancel() error {
return self.c.Helpers().Search.CancelPrompt()
}
func (self *SearchPromptController) prevHistory() error {
self.c.Helpers().Search.ScrollHistory(1)
return nil
}
func (self *SearchPromptController) nextHistory() error {
self.c.Helpers().Search.ScrollHistory(-1)
return nil
}
|