summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorKOREAN139 <korean139@gmail.com>2018-11-08 19:35:05 +0900
committerKOREAN139 <korean139@gmail.com>2018-11-08 19:35:05 +0900
commit9d79d32c94820effd0aa415a7fea522116781333 (patch)
treeac91ecb7829d73eeaf4b38a7cd8dc49d59e6fb3b /pkg
parentc2eaeab1f07e692cfa5b49b8bd707f17f7d1f892 (diff)
add scroll-past-bottom configuration option
with gui.scrollPastBottom option true, lazygit let user scroll past the bottom - which is default if option is false, user cannot scroll further when bottom of file has appeared in mainView
Diffstat (limited to 'pkg')
-rw-r--r--pkg/config/app_config.go1
-rw-r--r--pkg/gui/gui.go7
2 files changed, 7 insertions, 1 deletions
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index 7cde63de1..f789349b4 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -214,6 +214,7 @@ func GetDefaultConfig() []byte {
`gui:
## stuff relating to the UI
scrollHeight: 2
+ scrollPastBottom: true
theme:
activeBorderColor:
- white
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 35448922a..ee8fb1165 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -130,7 +130,12 @@ func (gui *Gui) scrollUpMain(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) scrollDownMain(g *gocui.Gui, v *gocui.View) error {
mainView, _ := g.View("main")
ox, oy := mainView.Origin()
- if oy < len(mainView.BufferLines()) {
+ y := oy
+ if !gui.Config.GetUserConfig().GetBool("gui.scrollPastBottom") {
+ _, sy := mainView.Size()
+ y += sy
+ }
+ if y < len(mainView.BufferLines()) {
return mainView.SetOrigin(ox, oy+gui.Config.GetUserConfig().GetInt("gui.scrollHeight"))
}
return nil