mirror of https://github.com/bobwen-dev/hunter
Merge branch 'master' into evil
This commit is contained in:
commit
065542aa12
15
src/files.rs
15
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 {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue