mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-25 09:46:37 +03:00
feat: tab switch wraparound (#160)
This commit is contained in:
parent
07d5df05f1
commit
ba3f603de4
@ -33,7 +33,11 @@ impl Tabs {
|
||||
}
|
||||
|
||||
pub fn switch(&mut self, idx: isize, rel: bool) -> bool {
|
||||
let idx = if rel { self.absolute(idx) } else { idx as usize };
|
||||
let idx = if rel {
|
||||
(self.idx as isize + idx).rem_euclid(self.items.len() as isize) as usize
|
||||
} else {
|
||||
idx as usize
|
||||
};
|
||||
|
||||
if idx == self.idx || idx >= self.items.len() {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user