From ee2dea71e6e21967bc705046f9650407d07cdada Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 2 Nov 2023 14:35:20 -0600 Subject: [PATCH] Ensure files sort after folders --- src/main.rs | 1 - src/project.rs | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 79eeb7a..4d8e743 100644 --- a/src/main.rs +++ b/src/main.rs @@ -507,7 +507,6 @@ impl cosmic::Application for App { }); } Message::PasteValue(value) => { - println!("Paste {:?}", value); match self.active_tab() { Some(tab) => { let mut editor = tab.editor.lock().unwrap(); diff --git a/src/project.rs b/src/project.rs index e44de90..c8d70c6 100644 --- a/src/project.rs +++ b/src/project.rs @@ -77,7 +77,11 @@ impl Ord for ProjectNode { Self::File { .. } => return Ordering::Less, _ => {} }, - _ => {} + // Files are always after folders + Self::File { .. } => match other { + Self::Folder { .. } => return Ordering::Greater, + _ => {} + }, } self.name().cmp(other.name()) }