random lockscreen message, remove rand dep for audio player, add version to about window, add o/O to malvim, add circles to draw, bug fixes, minor byte savings for font .alpha format
This commit is contained in:
stjet
2025-08-18 17:27:16 +00:00
parent 2c4455f623
commit 08c2358bdc
20 changed files with 135 additions and 70 deletions

View File

@@ -7,6 +7,14 @@ pub fn min(one: usize, two: usize) -> usize {
if one > two { two } else { one }
}
pub fn random_u32(seed: u32) -> u32 {
let mut seed = seed;
seed ^= seed << 13;
seed ^= seed >> 17;
seed ^= seed >> 5;
seed
}
pub trait Substring {
fn substring(&self, start: usize, end: usize) -> &str;
fn remove(&self, index: usize, len: usize) -> String;
@@ -88,18 +96,6 @@ pub fn calc_actual_lines<'a>(lines: impl Iterator<Item = &'a String>, max_chars_
actual_lines
}
pub fn calc_new_cursor_pos(cursor_pos: usize, new_length: usize) -> usize {
if cursor_pos >= new_length {
if new_length == 0 {
0
} else {
new_length - 1
}
} else {
cursor_pos
}
}
pub fn concat_paths(current_path: &str, add_path: &str) -> Result<PathBuf, ()> {
let mut new_path = PathBuf::from(current_path);
//if current_path is a file, automatically uses it's parent (a directory)