Skip to content

Commit

Permalink
Limit scroll padding
Browse files Browse the repository at this point in the history
  • Loading branch information
sayanarijit committed May 10, 2024
1 parent e0b0466 commit 182a201
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ book/

# nix
result

# test files
/init.lua
7 changes: 6 additions & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,12 @@ impl UI<'_> {
self.scrolltop = height * (dir.focus / height.max(1))
} else {
// Vim-like-scrolling
let padding = app.config.general.scroll_padding;
let padding = app
.config
.general
.scroll_padding
.min(height / 2)
.saturating_sub(1);
if dir.focus >= (self.scrolltop + height).saturating_sub(padding) {
// Scrolling down
self.scrolltop = (dir.focus + padding + 1)
Expand Down

0 comments on commit 182a201

Please sign in to comment.