Compare commits

...

2 Commits

Author SHA1 Message Date
Arijit Basu e0b0466e42
v0.21.8 (#716)
- Added vim-like scrolling as the default scrolling method. Set
`xplr.config.general.paginated_scrolling = false` to disable ~ by
@ElSamhaa & @sayanarijit.
- Added `xplr.config.general.scroll_padding` config option to set the
padding in vim-like scrolling ~ by @ElSamhaa & @sayanarijit.
- Fixed some color rendering issues ~ by @har7an.
- Added feature flag so that xplr can be build with system Lua ~ by
@nekopsykose.
- Fixed `ScrollUpHalf` behavior.
- `xplr.util.lscolor()` won't return nil anymore.
- Arguments passed to the custom dynamic layout Lua function will
include `scrolltop` field.
- Fixed node_type resolution for directories with `.` in their name ~ by
@abhinavnatarajan.
- Dependency updates.
3 weeks ago
Arijit Basu 805e1594ed
Fix vim scrolling 3 weeks ago

@ -778,27 +778,15 @@ impl UI<'_> {
self.scrolltop = height * (dir.focus / height.max(1))
} else {
// Vim-like-scrolling
self.scrolltop = match dir.focus.cmp(&self.scrolltop) {
Ordering::Greater => {
// Scrolling down
if dir.focus >= self.scrolltop + height {
dir.focus.saturating_sub(height + 1)
} else {
self.scrolltop
}
}
Ordering::Less => dir.focus,
Ordering::Equal => self.scrolltop,
};
// Add padding if possible
let padding = app.config.general.scroll_padding;
if padding != 0 {
if dir.focus < self.scrolltop + padding {
self.scrolltop = dir.focus.saturating_sub(padding);
} else if dir.focus >= self.scrolltop + height - padding {
self.scrolltop = dir.focus + padding - height + 1;
};
if dir.focus >= (self.scrolltop + height).saturating_sub(padding) {
// Scrolling down
self.scrolltop = (dir.focus + padding + 1)
.saturating_sub(height)
.min(dir.total.saturating_sub(height));
} else if dir.focus < self.scrolltop + padding {
// Scrolling up
self.scrolltop = dir.focus.saturating_sub(padding);
}
};

Loading…
Cancel
Save