mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Read all lines from task when starting to search
This commit is contained in:
parent
ec51efc82c
commit
338064ac2c
1 changed files with 24 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
)
|
||||
|
||||
|
@ -8,16 +9,16 @@ type MainViewController struct {
|
|||
baseController
|
||||
c *ControllerCommon
|
||||
|
||||
context types.Context
|
||||
otherContext types.Context
|
||||
context *context.MainContext
|
||||
otherContext *context.MainContext
|
||||
}
|
||||
|
||||
var _ types.IController = &MainViewController{}
|
||||
|
||||
func NewMainViewController(
|
||||
c *ControllerCommon,
|
||||
context types.Context,
|
||||
otherContext types.Context,
|
||||
context *context.MainContext,
|
||||
otherContext *context.MainContext,
|
||||
) *MainViewController {
|
||||
return &MainViewController{
|
||||
baseController: baseController{},
|
||||
|
@ -41,6 +42,13 @@ func (self *MainViewController) GetKeybindings(opts types.KeybindingsOpts) []*ty
|
|||
Handler: self.escape,
|
||||
Description: self.c.Tr.ExitFocusedMainView,
|
||||
},
|
||||
{
|
||||
// overriding this because we want to read all of the task's output before we start searching
|
||||
Key: opts.GetKey(opts.Config.Universal.StartSearch),
|
||||
Handler: self.openSearch,
|
||||
Description: self.c.Tr.StartSearch,
|
||||
Tag: "navigation",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,3 +69,15 @@ func (self *MainViewController) escape() error {
|
|||
self.c.Context().Pop()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *MainViewController) openSearch() error {
|
||||
if manager := self.c.GetViewBufferManagerForView(self.context.GetView()); manager != nil {
|
||||
manager.ReadToEnd(func() {
|
||||
self.c.OnUIThread(func() error {
|
||||
return self.c.Helpers().Search.OpenSearchPrompt(self.context)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue