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

@ -82,6 +82,12 @@ func (self *ListController) handleLineChange(change int) error {
// doing this check so that if we're holding the up key at the start of the list
// we're not constantly re-rendering the main view.
if before != after {
if change == -1 {
checkScrollUp(self.context.GetViewTrait(), self.c.UserConfig.Gui.ScrollOffMargin, before, after)
} else if change == 1 {
checkScrollDown(self.context.GetViewTrait(), self.c.UserConfig.Gui.ScrollOffMargin, before, after)
}
return self.context.HandleFocus(types.OnFocusOpts{})
}