From 73d90db51dd17ffb0fc526d2fa99ab50d861c5c3 Mon Sep 17 00:00:00 2001 From: Shupeng Xue Date: Mon, 24 Jun 2024 17:30:53 +1000 Subject: [PATCH] fix: adjust snap offset calculation in move command --- yazi-core/src/input/commands/move_.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yazi-core/src/input/commands/move_.rs b/yazi-core/src/input/commands/move_.rs index 8ff68f0a..441ac127 100644 --- a/yazi-core/src/input/commands/move_.rs +++ b/yazi-core/src/input/commands/move_.rs @@ -39,7 +39,7 @@ impl Input { )); let (limit, snap) = (self.limit(), self.snap_mut()); - if snap.offset + limit / 2 > snap.cursor { + if snap.offset > snap.cursor.saturating_sub(limit / 2) { snap.offset = snap.cursor.saturating_sub(limit / 2); } else if snap.value.is_empty() { snap.offset = 0;