From 700c600bf3e30352ee34dceda727186e66f739d7 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Mon, 30 Jun 2025 16:26:43 +0800 Subject: [PATCH] .. --- yazi-widgets/src/input/commands/move.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yazi-widgets/src/input/commands/move.rs b/yazi-widgets/src/input/commands/move.rs index 36822498..4ca3a965 100644 --- a/yazi-widgets/src/input/commands/move.rs +++ b/yazi-widgets/src/input/commands/move.rs @@ -38,17 +38,17 @@ impl Input { return snap.offset = 0; } - let o_off = snap.offset; + let (o_off, scrolloff) = (snap.offset, 5.min(limit / 2)); snap.offset = if n_cur <= o_cur { let it = snap.slice(0..n_cur).chars().rev().map(|c| if snap.obscure { '•' } else { c }); - let pad = InputSnap::find_window(it, 0, 5).end; + let pad = InputSnap::find_window(it, 0, scrolloff).end; if n_cur >= o_off { snap.offset.min(n_cur - pad) } else { n_cur - pad } } else { let count = snap.count(); let it = snap.slice(n_cur..count).chars().map(|c| if snap.obscure { '•' } else { c }); - let pad = InputSnap::find_window(it, 0, 5 + snap.mode.delta()).end; + let pad = InputSnap::find_window(it, 0, scrolloff + snap.mode.delta()).end; let it = snap.slice(0..n_cur + pad).chars().rev().map(|c| if snap.obscure { '•' } else { c }); let max = InputSnap::find_window(it, 0, limit).end;