Skip to content

Commit

Permalink
add scroll-past-bottom configuration option
Browse files Browse the repository at this point in the history
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
  • Loading branch information
KOREAN139 committed Nov 8, 2018
1 parent c2eaeab commit 9d79d32
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
gui:
# stuff relating to the UI
scrollHeight: 2 # how many lines you scroll by
scrollPastBottom: true # enable scrolling past the bottom
theme:
activeBorderColor:
- white
Expand Down
1 change: 1 addition & 0 deletions pkg/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func GetDefaultConfig() []byte {
`gui:
## stuff relating to the UI
scrollHeight: 2
scrollPastBottom: true
theme:
activeBorderColor:
- white
Expand Down
7 changes: 6 additions & 1 deletion pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9d79d32

Please sign in to comment.