summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrabite <rabite@posteo.de>2019-04-09 19:23:30 +0200
committerrabite <rabite@posteo.de>2019-04-09 19:23:30 +0200
commit065542aa1248ab19b440fbdf01c0dfdecf14c149 (patch)
tree45518c677afd61fde1cb6e1f55be900b58a10b38
parente3c2f3e4ec160945e7d0cf8167ddd7c08e2e8bf5 (diff)
parent1fd25d35c3b1989f6d9a243571095251bcc29535 (diff)
Merge branch 'master' into evilv1.0.3-evil
-rw-r--r--src/files.rs15
-rw-r--r--src/listview.rs5
2 files changed, 20 insertions, 0 deletions
diff --git a/src/files.rs b/src/files.rs
index f374974..0fd1ea2 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -363,10 +363,25 @@ impl Files {
new.selected = selected;
self.files.push(new);
});
+
self.sort();
+
+ if self.len() == 0 {
+ let placeholder = File::new_placeholder(&self.directory.path)?;
+ self.files.push(placeholder);
+ } else {
+ self.remove_placeholder();
+ }
+
Ok(())
}
+ fn remove_placeholder(&mut self) {
+ let dirpath = self.directory.path.clone();
+ self.find_file_with_path(&dirpath).cloned()
+ .map(|placeholder| self.files.remove_item(&placeholder));
+ }
+
pub fn handle_event(&mut self,
event: &DebouncedEvent) -> HResult<()> {
match event {
diff --git a/src/listview.rs b/src/listview.rs
index 7a3a5a0..3c85529 100644
--- a/src/listview.rs
+++ b/src/listview.rs
@@ -440,6 +440,11 @@ impl ListView<Files>
self.content.set_filter(filter);
+ if self.content.len() == 0 {
+ self.show_status("No files like that! Resetting filter").log();
+ self.content.set_filter(Some("".to_string()));
+ }
+
if self.get_selection() > self.len() {
self.set_selection(self.len());
}