Fix tui with 1 client (#734)

* unbreak tui with 1 client

* clippy
This commit is contained in:
Nicholas Lang 2022-08-19 05:30:26 -04:00 committed by GitHub
parent 93c361bcd9
commit 7b345fbba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,10 @@ impl TuiUI {
pub fn on_right(&mut self) {
if self.clients != 0 {
// clients_idx never 0
self.clients_idx = 1 + self.clients_idx % (self.clients - 1);
if self.clients - 1 != 0 {
// except for when it is ;)
self.clients_idx = 1 + self.clients_idx % (self.clients - 1);
}
}
}
@ -73,7 +76,8 @@ impl TuiUI {
// clients_idx never 0
if self.clients_idx == 1 {
self.clients_idx = self.clients - 1;
} else {
} else if self.clients - 1 != 0 {
// don't wanna be dividing by 0
self.clients_idx = 1 + (self.clients_idx - 2) % (self.clients - 1);
}
}