From f0f38347519d9ae5b8eaa757d716677c9189b174 Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Mon, 13 Mar 2023 10:39:57 +0530 Subject: [PATCH] Slightly optimize selection retention --- src/app.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app.rs b/src/app.rs index 9532e78..70e660f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1897,9 +1897,11 @@ impl App { } fn refresh_selection(mut self) -> Result { - // Should be able to select broken symlink - self.selection - .retain(|n| PathBuf::from(&n.absolute_path).symlink_metadata().is_ok()); + self.selection.retain(|n| { + let p = PathBuf::from(&n.absolute_path); + // Should be able to retain broken symlink + p.exists() || p.symlink_metadata().is_ok() + }); Ok(self) }