1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Add ScrollOffMargin user config

When set to a non-zero value, views will scroll when the selection gets this
close to the top or bottom of the view.
This commit is contained in:
Stefan Haller
2023-08-09 18:34:43 +02:00
parent 8f164f7bc5
commit 341b9725d4
6 changed files with 262 additions and 0 deletions

View File

@ -159,13 +159,25 @@ func (self *PatchExplorerController) GetMouseKeybindings(opts types.KeybindingsO
}
func (self *PatchExplorerController) HandlePrevLine() error {
before := self.context.GetState().GetSelectedLineIdx()
self.context.GetState().CycleSelection(false)
after := self.context.GetState().GetSelectedLineIdx()
if self.context.GetState().SelectingLine() {
checkScrollUp(self.context.GetViewTrait(), self.c.UserConfig.Gui.ScrollOffMargin, before, after)
}
return nil
}
func (self *PatchExplorerController) HandleNextLine() error {
before := self.context.GetState().GetSelectedLineIdx()
self.context.GetState().CycleSelection(true)
after := self.context.GetState().GetSelectedLineIdx()
if self.context.GetState().SelectingLine() {
checkScrollDown(self.context.GetViewTrait(), self.c.UserConfig.Gui.ScrollOffMargin, before, after)
}
return nil
}