precentage

This commit is contained in:
2025-01-25 22:07:27 +01:00
parent 5a9597aed4
commit eb90f619ce
4 changed files with 62 additions and 49 deletions
-13
View File
@@ -116,16 +116,3 @@ pub fn init<'a>(mouse: bool) -> crate::Result<crate::Console<'a>> {
mouse_position: None,
})
}
pub fn calculate_padding(string_length: usize, width: usize) -> (usize, usize) {
if width <= string_length {
// No padding needed if the string length is greater than or equal to the width
return (0, 0);
}
let total_padding = width - string_length;
let left_padding = total_padding / 2; // Floor division for left padding
let right_padding = total_padding - left_padding; // Remaining for right padding
(left_padding, right_padding)
}