mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-04 10:34:55 +02:00
fix(#2309): fix diff scroll
This commit is contained in:
parent
43b5a80738
commit
7bdba1abe4
@ -119,7 +119,7 @@ func (gui *Gui) resetControllers() {
|
||||
undoController := controllers.NewUndoController(common)
|
||||
globalController := controllers.NewGlobalController(common)
|
||||
contextLinesController := controllers.NewContextLinesController(common)
|
||||
verticalScrollControllerFactory := controllers.NewVerticalScrollControllerFactory(common)
|
||||
verticalScrollControllerFactory := controllers.NewVerticalScrollControllerFactory(common, &gui.viewBufferManagerMap)
|
||||
|
||||
branchesController := controllers.NewBranchesController(common)
|
||||
gitFlowController := controllers.NewGitFlowController(common)
|
||||
|
@ -3,16 +3,21 @@ package controllers
|
||||
import (
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
"github.com/jesseduffield/lazygit/pkg/tasks"
|
||||
)
|
||||
|
||||
// given we have no fields here, arguably we shouldn't even need this factory
|
||||
// struct, but we're maintaining consistency with the other files.
|
||||
type VerticalScrollControllerFactory struct {
|
||||
controllerCommon *controllerCommon
|
||||
viewBufferManagerMap *map[string]*tasks.ViewBufferManager
|
||||
}
|
||||
|
||||
func NewVerticalScrollControllerFactory(c *controllerCommon) *VerticalScrollControllerFactory {
|
||||
return &VerticalScrollControllerFactory{controllerCommon: c}
|
||||
func NewVerticalScrollControllerFactory(c *controllerCommon, viewBufferManagerMap *map[string]*tasks.ViewBufferManager) *VerticalScrollControllerFactory {
|
||||
return &VerticalScrollControllerFactory{
|
||||
controllerCommon: c,
|
||||
viewBufferManagerMap: viewBufferManagerMap,
|
||||
}
|
||||
}
|
||||
|
||||
func (self *VerticalScrollControllerFactory) Create(context types.Context) types.IController {
|
||||
@ -20,6 +25,7 @@ func (self *VerticalScrollControllerFactory) Create(context types.Context) types
|
||||
baseController: baseController{},
|
||||
controllerCommon: self.controllerCommon,
|
||||
context: context,
|
||||
viewBufferManagerMap: self.viewBufferManagerMap,
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +34,7 @@ type VerticalScrollController struct {
|
||||
*controllerCommon
|
||||
|
||||
context types.Context
|
||||
viewBufferManagerMap *map[string]*tasks.ViewBufferManager
|
||||
}
|
||||
|
||||
func (self *VerticalScrollController) Context() types.Context {
|
||||
@ -64,7 +71,12 @@ func (self *VerticalScrollController) HandleScrollUp() error {
|
||||
}
|
||||
|
||||
func (self *VerticalScrollController) HandleScrollDown() error {
|
||||
self.context.GetViewTrait().ScrollDown(self.c.UserConfig.Gui.ScrollHeight)
|
||||
scrollHeight := self.c.UserConfig.Gui.ScrollHeight
|
||||
self.context.GetViewTrait().ScrollDown(scrollHeight)
|
||||
|
||||
if manager, ok := (*self.viewBufferManagerMap)[self.context.GetViewName()]; ok {
|
||||
manager.ReadLines(scrollHeight)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user