From 8ba70f2f93f153ca22b50d6a30946049eed879af Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 9 May 2024 13:55:57 -0600 Subject: [PATCH] Workaround to support favorited files --- src/app.rs | 2 +- src/tab.rs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index b408e09..5305a53 100644 --- a/src/app.rs +++ b/src/app.rs @@ -148,7 +148,7 @@ impl MenuAction for Action { } #[derive(Clone, Copy, Debug, Eq, PartialEq)] -enum ContextItem { +pub enum ContextItem { NavBar(segmented_button::Entity), TabBar(segmented_button::Entity), } diff --git a/src/tab.rs b/src/tab.rs index 050b430..65b0cbe 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -1218,7 +1218,19 @@ impl Tab { } } Message::Location(location) => { - cd = Some(location); + // Workaround to support favorited files + match &location { + Location::Path(path) => { + if path.is_dir() { + cd = Some(location); + } else { + commands.push(Command::OpenFile(path.clone())); + } + } + Location::Trash => { + cd = Some(location); + } + } } Message::LocationUp => { // Sets location to the path's parent