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() {
|
if m.timeout.is_zero() {
|
||||||
m.percent = m.percent.saturating_sub(20);
|
m.percent = m.percent.saturating_sub(20);
|
||||||
} else if m.percent < 100 {
|
} else if m.percent < 100 {
|
||||||
m.percent = m.percent.saturating_add(20);
|
m.percent += 20;
|
||||||
} else {
|
} else {
|
||||||
m.timeout = m.timeout.saturating_sub(opt.interval);
|
m.timeout = m.timeout.saturating_sub(opt.interval);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,28 +103,23 @@ impl Tab {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
let results: Vec<_> = indices
|
let mut success = true;
|
||||||
.iter()
|
for f in indices.iter().filter_map(|i| self.current.files.get(*i)) {
|
||||||
.filter_map(|i| self.current.files.get(*i))
|
if state {
|
||||||
.map(|f| {
|
success &= self.selected.add(&f.url);
|
||||||
if state {
|
} else {
|
||||||
self.selected.add(&f.url)
|
self.selected.remove(&f.url);
|
||||||
} else {
|
}
|
||||||
self.selected.remove(&f.url);
|
|
||||||
true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
render!(!results.is_empty());
|
|
||||||
if results.into_iter().all(|b| b) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Notify::_push_warn(
|
if !success {
|
||||||
"Escape visual mode",
|
Notify::_push_warn(
|
||||||
"Some files cannot be selected due to path nesting conflict.",
|
"Escape visual mode",
|
||||||
);
|
"Some files cannot be selected, due to path nesting conflict.",
|
||||||
false
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render!();
|
||||||
|
success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue