mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-09-19 05:06:43 +02:00
This commit is contained in:
parent
b4424fcb69
commit
ba8ff1ae69
23 changed files with 1737 additions and 1689 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{*, browse::*, device::*, menu::*};
|
||||
use crate::{*, device::*};
|
||||
|
||||
/// Various possible dialog modes.
|
||||
///
|
||||
|
|
@ -127,3 +127,19 @@ impl Dialog {
|
|||
/// FIXME: implement
|
||||
pub fn browser_target (&self) -> Option<&BrowseTarget> { todo!() }
|
||||
}
|
||||
|
||||
/// Increment a wrapping counter.
|
||||
pub const fn wrap_inc (index: usize, count: usize) -> usize {
|
||||
if count > 0 { (index + 1) % count } else { 0 }
|
||||
}
|
||||
|
||||
/// Decrement a wrapping counter.
|
||||
pub const fn wrap_dec (index: usize, count: usize) -> usize {
|
||||
if count > 0 {
|
||||
let a = index.overflowing_sub(1).0;
|
||||
let b = count.saturating_sub(1);
|
||||
if a < b { a } else { b }
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue