From 74ba02a61bc9383247f88334bc995baf68cdb712 Mon Sep 17 00:00:00 2001 From: XOR-op <17672363+XOR-op@users.noreply.github.com> Date: Tue, 21 Nov 2023 00:02:39 -0500 Subject: [PATCH] feat: better handling of kill path separator --- yazi-core/src/input/commands/kill.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yazi-core/src/input/commands/kill.rs b/yazi-core/src/input/commands/kill.rs index 759f8d22..f1ef44d6 100644 --- a/yazi-core/src/input/commands/kill.rs +++ b/yazi-core/src/input/commands/kill.rs @@ -62,8 +62,12 @@ impl Input { input.take_while(|&c| CharKind::new(c) == first).count() + 1 } - let spaces = count_spaces(input.clone()); - spaces + count_characters(input.skip(spaces)) + let space_or_trailing_slash = match input.clone().next() { + Some(std::path::MAIN_SEPARATOR) => 1, + Some(c) if CharKind::new(c) == CharKind::Space => count_spaces(input.clone()), + _ => 0, + }; + space_or_trailing_slash + count_characters(input.skip(space_or_trailing_slash)) } pub fn kill<'a>(&mut self, opt: impl Into>) -> bool {