From 2b1b66e5e027e7e1586758168feb6203e3f61d72 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Mon, 22 Jan 2024 04:35:08 +0800 Subject: [PATCH] fix: ensure that changing directories occurs before searching --- yazi-core/src/tab/commands/search.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/yazi-core/src/tab/commands/search.rs b/yazi-core/src/tab/commands/search.rs index 909c429e..8bdf0f3d 100644 --- a/yazi-core/src/tab/commands/search.rs +++ b/yazi-core/src/tab/commands/search.rs @@ -59,11 +59,8 @@ impl Tab { let rx = UnboundedReceiverStream::new(rx).chunks_timeout(1000, Duration::from_millis(300)); pin!(rx); - let (mut first, ticket) = (true, FilesOp::prepare(&cwd)); + let ((), ticket) = (Tab::_cd(&cwd), FilesOp::prepare(&cwd)); while let Some(chunk) = rx.next().await { - if mem::replace(&mut first, false) { - Tab::_cd(&cwd); - } FilesOp::Part(cwd.clone(), chunk, ticket).emit(); } FilesOp::Done(cwd, None, ticket).emit();