From f4b92c73ed6fb99efce8a297a53011461f309d83 Mon Sep 17 00:00:00 2001 From: Burkhard Mittelbach Date: Wed, 2 Apr 2025 16:03:49 +0200 Subject: [PATCH] Fix move to home location on unmount Previously this would only work if the root of the unmounted file-system is open in a tab. This also checks for any sub-path. fixes: #915 --- src/app.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index af0e01c..b96e224 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2547,7 +2547,7 @@ impl Application for App { } } if !still_mounted { - unmounted.push(Location::Path(old_path)); + unmounted.push(old_path); } } } @@ -2562,7 +2562,12 @@ impl Application for App { for entity in entities { let title_opt = match self.tab_model.data_mut::(entity) { Some(tab) => { - if unmounted.contains(&tab.location) { + if unmounted.iter().any(|unmounted| { + tab.location + .path_opt() + .map(|location| location.starts_with(unmounted)) + .unwrap_or(false) + }) { tab.change_location(&home_location, None); Some(tab.title()) } else {