mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-12 11:15:00 +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)
|
undoController := controllers.NewUndoController(common)
|
||||||
globalController := controllers.NewGlobalController(common)
|
globalController := controllers.NewGlobalController(common)
|
||||||
contextLinesController := controllers.NewContextLinesController(common)
|
contextLinesController := controllers.NewContextLinesController(common)
|
||||||
verticalScrollControllerFactory := controllers.NewVerticalScrollControllerFactory(common)
|
verticalScrollControllerFactory := controllers.NewVerticalScrollControllerFactory(common, &gui.viewBufferManagerMap)
|
||||||
|
|
||||||
branchesController := controllers.NewBranchesController(common)
|
branchesController := controllers.NewBranchesController(common)
|
||||||
gitFlowController := controllers.NewGitFlowController(common)
|
gitFlowController := controllers.NewGitFlowController(common)
|
||||||
|
@ -3,16 +3,21 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"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
|
// given we have no fields here, arguably we shouldn't even need this factory
|
||||||
// struct, but we're maintaining consistency with the other files.
|
// struct, but we're maintaining consistency with the other files.
|
||||||
type VerticalScrollControllerFactory struct {
|
type VerticalScrollControllerFactory struct {
|
||||||
controllerCommon *controllerCommon
|
controllerCommon *controllerCommon
|
||||||
|
viewBufferManagerMap *map[string]*tasks.ViewBufferManager
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewVerticalScrollControllerFactory(c *controllerCommon) *VerticalScrollControllerFactory {
|
func NewVerticalScrollControllerFactory(c *controllerCommon, viewBufferManagerMap *map[string]*tasks.ViewBufferManager) *VerticalScrollControllerFactory {
|
||||||
return &VerticalScrollControllerFactory{controllerCommon: c}
|
return &VerticalScrollControllerFactory{
|
||||||
|
controllerCommon: c,
|
||||||
|
viewBufferManagerMap: viewBufferManagerMap,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *VerticalScrollControllerFactory) Create(context types.Context) types.IController {
|
func (self *VerticalScrollControllerFactory) Create(context types.Context) types.IController {
|
||||||
@ -20,6 +25,7 @@ func (self *VerticalScrollControllerFactory) Create(context types.Context) types
|
|||||||
baseController: baseController{},
|
baseController: baseController{},
|
||||||
controllerCommon: self.controllerCommon,
|
controllerCommon: self.controllerCommon,
|
||||||
context: context,
|
context: context,
|
||||||
|
viewBufferManagerMap: self.viewBufferManagerMap,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,6 +34,7 @@ type VerticalScrollController struct {
|
|||||||
*controllerCommon
|
*controllerCommon
|
||||||
|
|
||||||
context types.Context
|
context types.Context
|
||||||
|
viewBufferManagerMap *map[string]*tasks.ViewBufferManager
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *VerticalScrollController) Context() types.Context {
|
func (self *VerticalScrollController) Context() types.Context {
|
||||||
@ -64,7 +71,12 @@ func (self *VerticalScrollController) HandleScrollUp() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *VerticalScrollController) HandleScrollDown() 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
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user