mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
avoid overflow
This commit is contained in:
parent
499f5f4c73
commit
5ba632b6f9
1 changed files with 2 additions and 1 deletions
|
|
@ -39,7 +39,8 @@ impl Input {
|
|||
));
|
||||
|
||||
let (limit, snap) = (self.limit(), self.snap_mut());
|
||||
let offset = snap.cursor.saturating_sub(limit / 2).min(snap.len().saturating_sub(limit - 1));
|
||||
let offset =
|
||||
snap.cursor.saturating_sub(limit / 2).min(snap.len().saturating_sub(limit.saturating_sub(1)));
|
||||
if snap.offset != offset {
|
||||
snap.offset = offset;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue