mirror of
https://github.com/bobwen-dev/hunter
synced 2025-04-12 00:55:41 +02:00
fix calculation of the number of files when toggling hidden files
This commit is contained in:
parent
0f7be9e929
commit
48a4a8bb14
14
src/files.rs
14
src/files.rs
@ -550,11 +550,10 @@ impl Files {
|
|||||||
self.set_dirty();
|
self.set_dirty();
|
||||||
|
|
||||||
if self.show_hidden == true && self.len() > 1 {
|
if self.show_hidden == true && self.len() > 1 {
|
||||||
self.remove_placeholder();
|
self.remove_placeholder()
|
||||||
} else {
|
|
||||||
// avoid doing this twice, since remove_placeholder() does it too
|
|
||||||
self.recalculate_len();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.recalculate_len();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove_placeholder(&mut self) {
|
fn remove_placeholder(&mut self) {
|
||||||
@ -562,7 +561,9 @@ impl Files {
|
|||||||
self.find_file_with_path(&dirpath).cloned()
|
self.find_file_with_path(&dirpath).cloned()
|
||||||
.map(|placeholder| {
|
.map(|placeholder| {
|
||||||
self.files.remove_item(&placeholder);
|
self.files.remove_item(&placeholder);
|
||||||
self.recalculate_len();
|
if self.len > 0 {
|
||||||
|
self.len -= 1;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,7 +896,8 @@ impl File {
|
|||||||
.map(|dirs| {
|
.map(|dirs| {
|
||||||
let size = dirs.count();
|
let size = dirs.count();
|
||||||
dirsize.store(size as u32, Ordering::Release);
|
dirsize.store(size as u32, Ordering::Release);
|
||||||
});
|
}).map_err(HError::from)
|
||||||
|
.log();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,9 +987,11 @@ where
|
|||||||
.map(|(i, item)| {
|
.map(|(i, item)| {
|
||||||
let mut output = term::normal_color();
|
let mut output = term::normal_color();
|
||||||
|
|
||||||
if i == (self.selection - self.offset) {
|
// i counts from the offset, while selection counts from 0
|
||||||
|
if i + self.offset == self.selection {
|
||||||
output += &term::invert();
|
output += &term::invert();
|
||||||
}
|
}
|
||||||
|
|
||||||
output += &format!(
|
output += &format!(
|
||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
term::goto_xy(xpos, i as u16 + ypos),
|
term::goto_xy(xpos, i as u16 + ypos),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user