From 7a6bda47872d2fd0438c1cc22e6aa461904546e0 Mon Sep 17 00:00:00 2001 From: Francis Chua Date: Sun, 12 Nov 2023 00:15:55 +0000 Subject: [PATCH] skip once then skip spaces for consistent behavior --- yazi-core/src/input/input.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yazi-core/src/input/input.rs b/yazi-core/src/input/input.rs index fca2dd98..42e59bc5 100644 --- a/yazi-core/src/input/input.rs +++ b/yazi-core/src/input/input.rs @@ -61,13 +61,13 @@ impl Input { input: impl Iterator + Clone, stop_before_boundary: bool, ) -> usize { - // Move until we don't see any more whitespace. - let spaces_count = input.clone().take_while(|c| CharKind::new(*c) == CharKind::Space).count(); - let input = input.skip(spaces_count); - // If we want the *NEXT* end of word, then we want to skip the current // character. - let mut input = input.skip(stop_before_boundary.into()).peekable(); + let input = input.skip(stop_before_boundary.into()); + + // Move until we don't see any more whitespace. + let spaces_count = input.clone().take_while(|c| CharKind::new(*c) == CharKind::Space).count(); + let mut input = input.skip(spaces_count).peekable(); // Determine the current character class. let prev = input.peek().cloned();