mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Simplify the code
This commit is contained in:
parent
24243e6c60
commit
ce6a9e486b
2 changed files with 17 additions and 22 deletions
|
|
@ -38,7 +38,7 @@ impl Notify {
|
|||
if m.timeout.is_zero() {
|
||||
m.percent = m.percent.saturating_sub(20);
|
||||
} else if m.percent < 100 {
|
||||
m.percent = m.percent.saturating_add(20);
|
||||
m.percent += 20;
|
||||
} else {
|
||||
m.timeout = m.timeout.saturating_sub(opt.interval);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,28 +103,23 @@ impl Tab {
|
|||
return true;
|
||||
};
|
||||
|
||||
let results: Vec<_> = indices
|
||||
.iter()
|
||||
.filter_map(|i| self.current.files.get(*i))
|
||||
.map(|f| {
|
||||
if state {
|
||||
self.selected.add(&f.url)
|
||||
} else {
|
||||
self.selected.remove(&f.url);
|
||||
true
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
render!(!results.is_empty());
|
||||
if results.into_iter().all(|b| b) {
|
||||
return true;
|
||||
let mut success = true;
|
||||
for f in indices.iter().filter_map(|i| self.current.files.get(*i)) {
|
||||
if state {
|
||||
success &= self.selected.add(&f.url);
|
||||
} else {
|
||||
self.selected.remove(&f.url);
|
||||
}
|
||||
}
|
||||
|
||||
Notify::_push_warn(
|
||||
"Escape visual mode",
|
||||
"Some files cannot be selected due to path nesting conflict.",
|
||||
);
|
||||
false
|
||||
if !success {
|
||||
Notify::_push_warn(
|
||||
"Escape visual mode",
|
||||
"Some files cannot be selected, due to path nesting conflict.",
|
||||
);
|
||||
}
|
||||
|
||||
render!();
|
||||
success
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue