summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/vertical_scroll_controller.go
diff options
context:
space:
mode:
authorRyooooooga <eial5q265e5@gmail.com>2022-12-20 22:25:49 +0900
committerRyooooooga <eial5q265e5@gmail.com>2022-12-20 22:25:49 +0900
commit7bdba1abe4ffa9c53f04204fed82a8ac34e7d4a3 (patch)
tree1e973183a7b72d12cb6b917ba1709e6cc27c119b /pkg/gui/controllers/vertical_scroll_controller.go
parent43b5a8073842a5f9c5dd822aa68a22967f979610 (diff)
fix(#2309): fix diff scroll
Diffstat (limited to 'pkg/gui/controllers/vertical_scroll_controller.go')
-rw-r--r--pkg/gui/controllers/vertical_scroll_controller.go28
1 files changed, 20 insertions, 8 deletions
diff --git a/pkg/gui/controllers/vertical_scroll_controller.go b/pkg/gui/controllers/vertical_scroll_controller.go
index 3f3e9d177..388574df6 100644
--- a/pkg/gui/controllers/vertical_scroll_controller.go
+++ b/pkg/gui/controllers/vertical_scroll_controller.go
@@ -3,23 +3,29 @@ 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
+ 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 {
return &VerticalScrollController{
- baseController: baseController{},
- controllerCommon: self.controllerCommon,
- context: context,
+ baseController: baseController{},
+ controllerCommon: self.controllerCommon,
+ context: context,
+ viewBufferManagerMap: self.viewBufferManagerMap,
}
}
@@ -27,7 +33,8 @@ type VerticalScrollController struct {
baseController
*controllerCommon
- context types.Context
+ 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
}