fix: adjust snap offset calculation in move command

This commit is contained in:
Shupeng Xue 2024-06-24 17:30:53 +10:00
parent 574ee27993
commit 73d90db51d
No known key found for this signature in database
GPG key ID: A6C508165D76B601

View file

@ -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;